inspectr 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inspectr
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: A collection of python tools to inspect code quality.
5
5
  Maintainer-email: Alex Mueller <amueller474@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -36,6 +36,7 @@ where `<subtool>` is one of the following:
36
36
  - `authenticity`: looks for TODO comments, empty try/except blocks, and stub functions
37
37
  - `bare_ratio`: checks for the ratio of bare excepts to meaningful exception usage
38
38
  - `count_exceptions`: counts how many of each type of exception there are (including bare except)
39
+ - `duplicates`: looks for occurrences of duplicate code (default: 10+ lines, 3+ occurrences)
39
40
  - `size_counts`: various linecount-related code complexity checks
40
41
  - `with_open`: checks for `open` in the absense of `with` and manual calls to `close()`
41
42
 
@@ -18,8 +18,9 @@ where `<subtool>` is one of the following:
18
18
  - `authenticity`: looks for TODO comments, empty try/except blocks, and stub functions
19
19
  - `bare_ratio`: checks for the ratio of bare excepts to meaningful exception usage
20
20
  - `count_exceptions`: counts how many of each type of exception there are (including bare except)
21
+ - `duplicates`: looks for occurrences of duplicate code (default: 10+ lines, 3+ occurrences)
21
22
  - `size_counts`: various linecount-related code complexity checks
22
23
  - `with_open`: checks for `open` in the absense of `with` and manual calls to `close()`
23
24
 
24
25
  **Please note:** this project is in the early alpha stage, so don't expect the above subtool names
25
- to be stable between versions. I might even merge/split them at some point.
26
+ to be stable between versions. I might even merge/split them at some point.
@@ -6,13 +6,18 @@ from typing import List
6
6
 
7
7
  def main(files: List[pathlib.Path]) -> None:
8
8
  todo_count = 0
9
+ fixme_count = 0
10
+ placeholder_count = 0
9
11
  empty_try_except_count = 0
10
12
  stub_functions = []
11
13
 
12
14
  for f in files:
13
15
  src = f.read_text(encoding="utf-8")
14
16
 
17
+ # TODO: make these case insensitive
15
18
  todo_count += src.count("TODO")
19
+ fixme_count += src.count("FIXME")
20
+ placeholder_count += src.count("Placeholder")
16
21
 
17
22
  try:
18
23
  tree = ast.parse(src, filename=str(f))
@@ -36,6 +41,9 @@ def main(files: List[pathlib.Path]) -> None:
36
41
  continue
37
42
  elif isinstance(stmt, ast.Return) and stmt.value is None:
38
43
  continue
44
+ elif isinstance(stmt, ast.Expr) and isinstance(stmt.value, ast.Constant) and isinstance(stmt.value.value, str):
45
+ # ignore docstrings
46
+ continue
39
47
  else:
40
48
  is_stub = False
41
49
  break
@@ -44,6 +52,8 @@ def main(files: List[pathlib.Path]) -> None:
44
52
 
45
53
  print("Analysis results:")
46
54
  print(f" TODO comments: {todo_count}")
55
+ print(f" FIXME comments: {fixme_count}")
56
+ print(f" Placeholder comments: {placeholder_count}")
47
57
  print(f" Empty try/except blocks: {empty_try_except_count}")
48
58
  print(f" Stub functions/methods: {len(stub_functions)}")
49
59
  for stub in stub_functions:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: inspectr
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: A collection of python tools to inspect code quality.
5
5
  Maintainer-email: Alex Mueller <amueller474@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -36,6 +36,7 @@ where `<subtool>` is one of the following:
36
36
  - `authenticity`: looks for TODO comments, empty try/except blocks, and stub functions
37
37
  - `bare_ratio`: checks for the ratio of bare excepts to meaningful exception usage
38
38
  - `count_exceptions`: counts how many of each type of exception there are (including bare except)
39
+ - `duplicates`: looks for occurrences of duplicate code (default: 10+ lines, 3+ occurrences)
39
40
  - `size_counts`: various linecount-related code complexity checks
40
41
  - `with_open`: checks for `open` in the absense of `with` and manual calls to `close()`
41
42
 
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
5
5
 
6
6
  [project]
7
7
  name = "inspectr"
8
- version = "0.0.4"
8
+ version = "0.0.5"
9
9
  description = "A collection of python tools to inspect code quality. "
10
10
  maintainers = [
11
11
  {name = "Alex Mueller", email="amueller474@gmail.com"},
File without changes
File without changes
File without changes
File without changes
File without changes