Closed Bug 1508686 Opened 6 years ago Closed 6 years ago

checkpystyle hook complains incorrectly about missing newlines at the end of files

Categories

(Developer Services :: Mercurial: mozext, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: ted, Assigned: Pike)

Details

(Keywords: in-triage)

Attachments

(1 obsolete file)

I've noticed this a few times lately while committing. From just today:

$ hg ci -m "bug 1507827 - start sccache server explicitly in rusttest builds. r?build"
created new head
testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py:12:2: W292 no newline at end of file

That file does in fact have a newline at the end! My change to the file consisted of:

diff --git a/testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py b/testing/mozha
--- a/testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py
+++ b/testing/mozharness/configs/builds/taskcluster_sub_win64/rusttests_opt.py
@@ -1,12 +1,12 @@
 config = {
     'default_actions': [
         'build',
     ],
     'stage_platform': 'win64-rusttests',
     'env': {
         'XPCOM_DEBUG_BREAK': 'stack-and-abort',
     },
-    'build_targets': ['pre-export', 'export', 'recurse_rusttests'],
+    'build_targets': ['start-sccache', 'pre-export', 'export', 'recurse_rusttests'],
     'disable_package_metrics': True,
     'artifact_flag_build_variant_in_try': None,
 }
Keywords: in-triage
This needs a splitlines(True) when passing in lines in critique, to match what https://github.com/PyCQA/pycodestyle/blob/2.2.0/pycodestyle.py#L1508 does.
Taking, but this raises more trouble than it fixes, at least for the code I work on. Filed bug 1511439 on that.
Assignee: nobody → l10n
This matches what pycodestyle does if you pass in a file,
and fixes the problem if you're touching the last line of
a file. Without including the line ending, it raises a warning
about a missing trailing newline.
Per bug 1511439 comment 1, I added a patch there to just remove `critic`.
Attachment #9029005 - Attachment is obsolete: true
Resolving this as WORKSFORME, as we removed critic.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: