Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed May 22, 2024
2 parents 96c32b2 + 5e6ad7a commit e2f4f3a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/python-flake8-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Python-Flake8-Linter

'on':
push:
branches:
- master
pull_request:
branches:
- master

jobs:
flake8:
name: Flake8
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: pip install flake8
- name: Run Flake8
run: |
flake8 --max-line-length=120 .
2 changes: 1 addition & 1 deletion metrics/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


def doer(tlist: list[tuple[Any, javalang.tree.ClassDeclaration]]) -> float:
"""Ratio between the number of attributes that are data primitives and the number of attributes that are pointers to objects.
"""Ratio of the quantity of attributes that are data primitives and those that are pointers to objects.
:rtype: float
"""
declaration = tlist[0][1].filter(javalang.tree.FieldDeclaration)
Expand Down
11 changes: 10 additions & 1 deletion metrics/cyclomatic_complexity.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@ def branches(parser_class: tree.CompilationUnit) -> int:
if isinstance(parser_class, tree.BinaryOperation):
if parser_class.operator in ('&&', '||'):
count = 1
elif (isinstance(parser_class, (tree.ForStatement, tree.IfStatement, tree.WhileStatement, tree.DoStatement, tree.TernaryExpression))):
elif isinstance(
parser_class,
(
tree.ForStatement,
tree.IfStatement,
tree.WhileStatement,
tree.DoStatement,
tree.TernaryExpression
)
):
count = 1
elif isinstance(parser_class, tree.SwitchStatementCase):
count = 1
Expand Down

0 comments on commit e2f4f3a

Please sign in to comment.