Skip to content

Conversation

@jamesbraza
Copy link
Contributor

Motivation: #1437 (comment)

While I was at it, I cleaned up the pre-commit config and added the end-of-file-fixer hook for clean GitHub diff.

@jamesbraza
Copy link
Contributor Author

@janiversen the pylint error being encountered here has nothing to do with this PR. I think this is good to go 👍

@janiversen
Copy link
Collaborator

Well dev did not report that error, so you have changed something.

- id: check-added-large-files
- repo: https://github.com/pycqa/isort
- id: trailing-whitespace
- id: end-of-file-fixer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not activate that, we do not want it.

rev: 5.12.0
hooks:
- id: isort
- id: isort
Copy link
Collaborator

Choose a reason for hiding this comment

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

@alexrudd2 all these “- “ to “ -“ changes are you ok with them ? seems like not needed to me.

Copy link
Collaborator

@janiversen janiversen Mar 17, 2023

Choose a reason for hiding this comment

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

to me it looks as a change just to make a change, but it is your turf.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I run yamllint locally and it was complaining

image

These errors are all fixed now.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Well our CI did not complain, so you are running something we do not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

our precommit runs a yaml test, and do not complain. If you run a linter locally place make sure it runs with the same options.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay sure, reverted most of the changes just now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay per your request jan I reverted this entire file, even though I believe the changes were valuable

Copy link
Collaborator

Choose a reason for hiding this comment

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

I tried to explain to you do not mix issues in the same pull request, that is the important point. Whether or not they are valuable is something to be discussed outside this PR.

feel free to submit another Pull request with the end_of_file_fixer, then we can discuss that change, which can include a reformatting of pre_commit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep I hear that, I made #1442

One other comment is in CI, something like pre-commit run --from-ref origin/dev --to-ref HEAD can be interesting.

It means pre-commit is scoped to that particular PR, not run on files outside of it. This technique is sometimes called "incremental". One pro of this is one can make pre-commit config tweaks, without having to make repo wide changes (currently mandated by --all-files). One con of this is it can be seen as adding tech debt, since the remainder of the repo is sort of "stale" with respect to the pre-commit config. I am not contributing this, more just an alternate balance I have seen struck.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No in CI we try to run on the whole source tree, because we have all to often seen side effects in files not touched.

Locally it needs to be fast so it runs only on the changed files and not with all CI checks.

THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Copy link
Collaborator

Choose a reason for hiding this comment

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

no

include requirements.txt
include README.rst
include CHANGELOG.rst
include LICENSE
Copy link
Collaborator

Choose a reason for hiding this comment

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

no

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a missing empty line here, hence GitHub with the red symbol. This standardizes all files to have one empty line at the end

Copy link
Collaborator

Choose a reason for hiding this comment

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

My point was, please do not touch the file endings, all files are not equal.

Copy link
Contributor Author

@jamesbraza jamesbraza Mar 17, 2023

Choose a reason for hiding this comment

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

Why aren't they equal?

Imo this is a one-time fix, just standardize every line to have one newline:

  • Better for GitHub (no red warning symbols)
  • Works with everyone's IDE
  • One line plays best when scrolling to EOF
  • Having end-of-file-fixer standardizes all files, which imo is minor win

At multiple companies in multiple industries we roll with this, and it's fine imo.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Multiple companies have multiple policies and standards....we are lucky we only have our own :-)

I will review your PR again, when CI is green, but you have to find better arguments that "multiple....." to convince me that adding end-of-file-fixer is worth it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha yeah sure. CI is green, if you would like me to remove end-of-file-fixer, lemme know

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not want that check, at least not in this PR. If we want that check (and it is a big if) it should be done "loudly" in its own PR.

)


# ---------------------------------------------------------------------------#
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@janiversen I removed this to fix the pylint message, I believe this was a stale comment anyways

pylint-dev/pylint#1681

@janiversen
Copy link
Collaborator

@jamesbraza your original issue with all would have been merged fast, had you not blended in unrelated changes. Changing CI/precommit etc are a lot more sensitive, because it affects our daily work.

@jamesbraza
Copy link
Contributor Author

@jamesbraza your original issue with all would have been merged fast, had you not blended in unrelated changes. Changing CI/precommit etc are a lot more sensitive, because it affects our daily work.

Part of it is I was using end-of-file-fixer to ensure all my end-of-file changes were high quality, and automated 🤖

Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

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

you still have a number of changes not related to "all", please clean that.

We can discuss the other changes in another PR.

@jamesbraza jamesbraza requested a review from janiversen March 17, 2023 18:09
Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

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

mostly small leftovers.

Patch for serial_asyncio, also submitted to the repo:

https://github.com/pyserial/pyserial-asyncio/pull/94

Copy link
Collaborator

Choose a reason for hiding this comment

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

We do NOT change in a copied module. Apart from that I believe it has nothing to do with the PR.

@jamesbraza
Copy link
Contributor Author

jamesbraza commented Mar 17, 2023

Okay, I leave this PR in your hands now, I think it's good to go! Feel free to make changes to the branch directly

@jamesbraza jamesbraza requested a review from janiversen March 17, 2023 18:57
Copy link
Collaborator

@janiversen janiversen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks.

@janiversen janiversen merged commit 599d57e into pymodbus-dev:dev Mar 17, 2023
@jamesbraza jamesbraza deleted the all-to-top branch March 17, 2023 19:07
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants