Skip to content

Commit e370d11

Browse files
committed
Updates and clean ups
1 parent ba644c2 commit e370d11

File tree

1 file changed

+37
-31
lines changed

1 file changed

+37
-31
lines changed

Makefile

Lines changed: 37 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
##########################################################################
44
## REQUIREMENTS
55
#
6-
# The following packages are required to run this makefile:
7-
# pytest For running tests
8-
# coverage For running test coverage
9-
# cloc For counting code
10-
# pylint For running linting on code
11-
# setuptools For creating distributions
6+
# This file requires certain dependencies for full functionality.
7+
#
8+
# The following Python packages are required:
9+
# pytest For running tests
10+
# coverage For running test coverage
11+
# pylint For running linting on code
12+
# setuptools For creating distributions
13+
#
14+
# The following command line utilities are required:
15+
# cloc For counting code
1216
#
1317

1418
##########################################################################
@@ -21,58 +25,60 @@ LINT_FILE = _lint.txt
2125
## CODE COUNTING
2226

2327
# Run all counts
24-
run_counts:
25-
@make count_size
26-
@make count_cloc
27-
@make count_cloc_tests
28+
run-counts:
29+
@make count-size
30+
@make count-module
31+
@make count-tests
2832

2933
# Count the total number of lines in the module
30-
count_size:
31-
@echo "\n\n CHECK MODULE SIZE:"
34+
count-size:
35+
@printf "\n\nCHECK MODULE SIZE:"
3236
@printf "\nNumber of lines of code & comments in the module: "
3337
@find ./$(MODULE) -name "*.py" -type f -exec grep . {} \; | wc -l
3438

35-
# Count code with CLOC, excluding test files
36-
count_cloc:
37-
@printf "\n\n CLOC OUTPUT (EXCLUDING TESTS): \n"
39+
# Count module code with CLOC, excluding test files
40+
count-module:
41+
@printf "\n\nCLOC OUTPUT - MODULE: \n"
3842
@cloc $(MODULE) --exclude-dir='tests'
3943

4044
# Count test code, with CLOC
41-
count_cloc_tests:
42-
@printf "\n\n CLOC OUTPUT - TEST FILES: \n"
45+
count-tests:
46+
@printf "\n\nCLOC OUTPUT - TEST FILES: \n"
4347
@cloc $(MODULE)/tests --exclude-dir='test_files'
4448

4549
##########################################################################
4650
## CODE TESTING
4751

4852
# Run all tests
49-
run_tests:
50-
make coverage
51-
make doctests
53+
run-tests:
54+
@make coverage
55+
@make doctests
5256

5357
# Run tests
5458
tests:
59+
@printf "\n\nRUN TESTS: \n"
5560
@pytest
5661

5762
# Run test coverage
5863
coverage:
59-
@printf "\n\n RUN TESTS & TEST COVERAGE: \n"
64+
@printf "\n\nRUN TESTS: \n"
6065
@coverage run --source $(MODULE) -m py.test
66+
@printf "\n\nCHECK COVERAGE: \n"
6167
@coverage report --omit="*/tests*"
6268

6369
# Run doctests
6470
doctests:
65-
@printf "\n\n CHECK DOCTEST EXAMPLES: \n"
71+
@printf "\n\nCHECK DOCTEST EXAMPLES: \n"
6672
@pytest --doctest-modules --ignore=$(MODULE)/tests $(MODULE)
6773

6874
##########################################################################
6975
## CODE LINTING
7076

7177
# Run pylint and print summary
72-
# Note: --exit-zero is because for some reason pylint
73-
# throws an error otherwise. Unclear why.
74-
run_lints:
75-
@printf "\n\n\n RUN PYLINT ACROSS MODULE: \n"
78+
# Note: --exit-zero is because pylint throws an error when called
79+
# from a Makefile. Unclear why, but this avoids it stopping.
80+
run-lints:
81+
@printf "\n\nRUN PYLINT ACROSS MODULE: \n"
7682
@pylint $(MODULE) --ignore tests --exit-zero > $(LINT_FILE)
7783
@tail -n4 $(LINT_FILE)
7884

@@ -81,17 +87,17 @@ run_lints:
8187

8288
# Run a summary of the module
8389
summary:
84-
make run_counts
85-
make run_tests
86-
make run_lints
90+
@make run-counts
91+
@make run-tests
92+
@make run-lints
8793

8894
##########################################################################
8995
## DISTRIBUTION
9096

9197
# Create a distribution build of the module
92-
distribution:
98+
dist:
9399
@python setup.py sdist bdist_wheel
94100

95101
# Clear out distribution files
96-
clear_dist:
102+
clear-dist:
97103
@rm -rf build dist $(MODULE).egg-info

0 commit comments

Comments
 (0)