Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/lintering #27

Closed
wants to merge 8 commits into from
Closed

Conversation

g3n35i5
Copy link

@g3n35i5 g3n35i5 commented Jan 16, 2022

Running black and isort on the entire code base. This could be automated in future, e.g. by using tox or gh actions (in order to validate each commit / PR)

This resolves #26

@codecov
Copy link

codecov bot commented Jan 17, 2022

Codecov Report

Merging #27 (3429ca7) into main (b6ca69c) will decrease coverage by 1.12%.
The diff coverage is 92.70%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
- Coverage   93.67%   92.55%   -1.13%     
==========================================
  Files          44       44              
  Lines        2008     2014       +6     
  Branches      171      200      +29     
==========================================
- Hits         1881     1864      -17     
- Misses        107      129      +22     
- Partials       20       21       +1     
Impacted Files Coverage Δ
atpbar/presentation/detect/jupy.py 84.61% <0.00%> (ø)
tests/presentation/test_is_jupyter_notebook.py 100.00% <ø> (ø)
tests/test_version.py 100.00% <ø> (ø)
tests/scenarios/conftest.py 73.68% <47.61%> (-10.53%) ⬇️
atpbar/presentation/detect/spy.py 66.66% <50.00%> (ø)
atpbar/stream.py 51.28% <66.66%> (ø)
tests/scenarios/test_readme_mantichora.py 42.85% <77.77%> (+1.39%) ⬆️
atpbar/presentation/txtprint.py 82.85% <83.33%> (+0.50%) ⬆️
atpbar/presentation/base.py 88.04% <84.61%> (ø)
atpbar/main.py 90.62% <87.50%> (ø)
... and 40 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6ca69c...3429ca7. Read the comment docs.

Copy link
Member

@TaiSakuma TaiSakuma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some comments inline and pushed some commits.

For imports under tests/, I order imports in a certain way: general modules, test-related modules (e.g., pytest, mock, and lastly from atpbar. Is it possible to configure isort in this way? Or otherwise can you not use isort on test files?

Comment on lines 3 to 8
from ._version import get_versions
__version__ = get_versions()['version']
from .funcs import disable, find_reporter, flush, register_reporter
from .main import atpbar

__version__ = get_versions()["version"]
del get_versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you revert these lines to the original order?

The get_versions is used in this file and deleted while other imported objects are there to be imported by users' scripts.

@@ -1,4 +1,3 @@

# This file helps to compute a version number in source trees obtained from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not modify this file. This file is part of Versioneer is not managed in this repo.

'ipywidgets>=7.5',
]
}
"lintering": [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please call this dev instead of lintering.

Comment on lines -50 to -111
pytest.param(
dict(taskid=1, last=False),
[ ], [ ], [ ], [ ],
[1], [ ], [ ], [ ],
True
),
pytest.param(
dict(taskid=1, last=False),
[1], [ ], [ ], [ ],
[1], [ ], [ ], [ ],
True
),
pytest.param(
dict(taskid=1, last=False),
[ ], [1], [ ], [ ],
[ ], [1], [ ], [ ],
True
),
pytest.param(
dict(taskid=1, last=False),
[ ], [ ], [1], [ ],
[ ], [ ], [1], [ ],
True
),
pytest.param(
dict(taskid=1, last=False),
[ ], [ ], [ ], [1],
[ ], [ ], [ ], [1],
False
),

pytest.param(dict(taskid=1, last=False), [], [], [], [], [1], [], [], [], True),
pytest.param(dict(taskid=1, last=False), [1], [], [], [], [1], [], [], [], True),
pytest.param(dict(taskid=1, last=False), [], [1], [], [], [], [1], [], [], True),
pytest.param(dict(taskid=1, last=False), [], [], [1], [], [], [], [1], [], True),
pytest.param(dict(taskid=1, last=False), [], [], [], [1], [], [], [], [1], False),
##
pytest.param(
dict(taskid=1, last=True),
[ ], [ ], [ ], [ ],
[ ], [ ], [1], [ ],
True
),
pytest.param(
dict(taskid=1, last=True),
[1], [ ], [ ], [ ],
[ ], [ ], [1], [ ],
True
),
pytest.param(
dict(taskid=1, last=True),
[ ], [1], [ ], [ ],
[ ], [ ], [1], [ ],
True
),
pytest.param(
dict(taskid=1, last=True),
[ ], [ ], [1], [ ],
[ ], [ ], [1], [ ],
True
),
pytest.param(
dict(taskid=1, last=True),
[ ], [ ], [ ], [1],
[ ], [ ], [ ], [1],
False
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change these lines. You can add #fmt: on/off

Comment on lines -146 to +135
[ ], [ ], [ ], [ ],
[ ], [ ], [ ], [ ],
[],
[],
[],
[],
[],
[],
[],
[],
),
pytest.param(
[ ], [10, 11, 12], [ ], [30, 31, 32],
[ ], [10, 11, 12], [ ], [30, 31, 32],
[],
[10, 11, 12],
[],
[30, 31, 32],
[],
[10, 11, 12],
[],
[30, 31, 32],
),
pytest.param(
[1, 2], [10, 11, 12], [20, 21], [30, 31, 32],
[ ], [10, 11, 12, 1, 2], [ ], [30, 31, 32, 20, 21],
[1, 2],
[10, 11, 12],
[20, 21],
[30, 31, 32],
[],
[10, 11, 12, 1, 2],
[],
[30, 31, 32, 20, 21],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change these lines. You can add #fmt: on/off

})
module = sys.modules['atpbar.presentation.create']
monkeypatch.setattr(module, 'sys', f)
f = mock.Mock(**{"stdout.isatty.return_value": ret, "stdout.write.side_effect": lambda x: org_stdout.write(x)})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you keep this as multiple lines? If you add a comma (,) after org_stdout.write(x), Black will keep it as multiple lines.

@TaiSakuma TaiSakuma closed this May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Running code formatter / linter on entire codebase
2 participants