Closed Bug 1675131 Opened 4 years ago Closed 4 years ago

Make whitespace / newline linter also fail for extra empty lines at the end of files (\n\n$ => \n$)

Categories

(Developer Infrastructure :: Lint and Formatting, task, P3)

Tracking

(firefox86 fixed)

RESOLVED FIXED
86 Branch
Tracking Status
firefox86 --- fixed

People

(Reporter: Gijs, Assigned: ikartikgautam, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [lang=python])

Attachments

(1 file)

As in summary. This is catching people out for l10n files, and it should really be a standard for all our other code files, too.

The severity field is not set for this bug.
:ahal, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(ahal)
Severity: -- → S3
Flags: needinfo?(ahal)
Priority: -- → P3

Hi,

I am very new to contributing to mozilla. Sir can you please guide me on how should i approach this issue and fix it. I think i can fix this issue. I just need your help. I tried to figure out myself fixing this issue, but unfortunately i failed, hence require your help.

Thank You,
Kartik Gautam

Flags: needinfo?(sledru)

Sure, how can I help you? Please be specific in your request! :)
Cheers

Flags: needinfo?(sledru)

Hi,

Sir, i am working on it, i just have one question am i required to only make linter fail for missing empty lines at the end of files or after failing it should also fix the error ?

Thank You,
Kartik Gautam

Flags: needinfo?(sledru)

Good question.
First, you can do a first change which will detect this.

Then, you could indeed in the future fix it but it doesn't have to in the v1 :)

Flags: needinfo?(sledru)

(In reply to Sylvestre Ledru [:Sylvestre] from comment #6)

Good question.
First, you can do a first change which will detect this.

Then, you could indeed in the future fix it but it doesn't have to in the v1 :)

Sir, I have made the changes, Should i add you as reviewer? Also i am a little unsure about the error messages, please take a look at them too.

Yeah, thanks :)

Assignee: nobody → ikartikgautam
Status: NEW → ASSIGNED

Sorry, i think i have done something wrong while submitting for review, i don’t know why it submitted my earlier contribution too. and here it commented "Depends on D97943". Can you please suggest me, what should i do ?

I removed the dependency for you (before seeing your message).

Depends on: 1679758
Type: defect → task
Depends on: 1680556

This patch and bug 1680556 are backward: the linter should fail if a file doesn't have an empty line at the end, not the other way around.

(In reply to Francesco Lodolo [:flod] from comment #12)

This patch and bug 1680556 are backward: the linter should fail if a file doesn't have an empty line at the end, not the other way around.

So does it mean that it should only give error if file does not have empty lines at end ? be it any number of of empty lines ?
Right now it checks for if file have any extra empty line at end of file.

Flags: needinfo?(francesco.lodolo)
Summary: Make whitespace / newline linter also fail for missing empty lines at the end of files → Make whitespace / newline linter also fail for extra empty lines at the end of files (\n\n$ => \n$)

Kartik, please continue to work on it. It is great :)
I replied in the reviews with details

Currently, you are working on:

----
mycode\n
\n
----

to be replaced by:

----
mycode\n
----

We will open a different bug for the second thing which is:

----
mycode
----

to be replaced by:

----
mycode\n
----
Flags: needinfo?(francesco.lodolo)
Pushed by sledru@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/eb1260476732 Make whitespace / newline linter also fail for missing empty lines at the end of files. r=sylvestre DONTBUILD
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 86 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: