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

Auto-Linting: Spelling Black Style Checker #2800

Merged
merged 32 commits into from
Apr 10, 2023
Merged

Conversation

mrmundt
Copy link
Contributor

@mrmundt mrmundt commented Apr 10, 2023

Fixes #329

Summary/Motivation:

Finally, this is the PR that adds in the auto-linting pre-req for the regular testing suite.

Changes proposed in this PR:

  • Spell checker (with correctly spelled but falsely identified words represented in .github/workflows/typos.toml
  • Black style checker (current version: 23.3.0 - which adds some extra spaces between classes/functions. Ignores the examples/pyomobook/python-ch/BadIndent.py file as it is intentionally wrong)
  • Introduces the .git-blame-ignore-revs file which can be used to ignore all of the black style changes when running a git blame command:
    1. git blame --ignore-revs-file .git-blame-ignore-revs
    2. git config blame.ignoreRevsFile .git-blame-ignore-revs

Legal Acknowledgement

By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the BSD license.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@mrmundt mrmundt requested review from jsiirola and Robbybp April 10, 2023 14:30
@mrmundt mrmundt requested review from emma58 and blnicho April 10, 2023 14:30
Copy link
Member

@jsiirola jsiirola left a comment

Choose a reason for hiding this comment

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

Just a couple minor edits

pyomo/contrib/pynumero/sparse/block_matrix.py Outdated Show resolved Hide resolved
pyomo/contrib/pyros/tests/test_grcs.py Outdated Show resolved Hide resolved
pyomo/contrib/pyros/tests/test_grcs.py Outdated Show resolved Hide resolved
pyomo/core/base/range.py Outdated Show resolved Hide resolved
pyomo/mpec/complementarity.py Outdated Show resolved Hide resolved
@mrmundt mrmundt requested a review from jsiirola April 10, 2023 16:43
@codecov
Copy link

codecov bot commented Apr 10, 2023

Codecov Report

Patch coverage: 78.72% and no project coverage change.

Comparison is base (f723680) 87.00% compared to head (4851561) 87.01%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2800   +/-   ##
=======================================
  Coverage   87.00%   87.01%           
=======================================
  Files         763      763           
  Lines       87213    87213           
=======================================
+ Hits        75881    75886    +5     
+ Misses      11332    11327    -5     
Flag Coverage Δ
linux 84.02% <78.26%> (+<0.01%) ⬆️
osx 73.52% <45.65%> (ø)
other 84.20% <78.26%> (ø)
win 81.53% <78.26%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
examples/dae/simulator_ode_multindex_example.py 62.71% <ø> (ø)
examples/gdp/eight_process/eight_proc_logical.py 91.13% <ø> (ø)
examples/gdp/jobshop.py 88.88% <ø> (ø)
examples/gdp/small_lit/nonconvex_HEN.py 67.56% <ø> (ø)
examples/kernel/piecewise_nd_functions.py 55.42% <ø> (ø)
examples/kernel/special_ordered_sets.py 100.00% <ø> (ø)
examples/pyomo/core/t1.py 100.00% <ø> (ø)
examples/pyomo/core/t5.py 100.00% <ø> (ø)
examples/pyomo/piecewise/convex.py 100.00% <ø> (ø)
examples/pyomo/piecewise/indexed.py 100.00% <ø> (ø)
... and 130 more

... and 73 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@mrmundt mrmundt merged commit 5a9cc2e into Pyomo:main Apr 10, 2023
Copy link
Contributor

@Robbybp Robbybp left a comment

Choose a reason for hiding this comment

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

I went through the contrib files and noted a few places where user code could break. I'm still in favor of merging, just making sure people are aware.

def ScenariosFromBoostrap(self, addtoSet, numtomake, seed=None):
def ScenariosFromBootstrap(self, addtoSet, numtomake, seed=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

This could break a user's code, right? Should a deprecation path be added?

name = "Boostrap" + str(index)
name = "Bootstrap" + str(index)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this name used anywhere?

class TightenContraintFromVars(IsomorphicTransformation):
class TightenConstraintFromVars(IsomorphicTransformation):
Copy link
Contributor

Choose a reason for hiding this comment

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

This could potentially break a user's code, although TransformationFactory would be the usual way to construct this object, which doesn't change, and the transformation is already deprecated.

@mrmundt mrmundt deleted the auto-linting branch July 25, 2023 17:36
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.

Make the entire code base PEP8 compliant.
3 participants