-
Notifications
You must be signed in to change notification settings - Fork 3
flake8 plugin to enforce short files #7
Comments
Hi Zupo, You could check this code from Flakes8 documentation if it helps. It sets exception based on the maximum length per line of code in pg 17 and also try for maximum complexity in page 24. source: https://buildmedia.readthedocs.org/media/pdf/flake8/latest/flake8.pdf FOR MAXIMUM LINE LENGTH --max-line-length= https://some-super-long-domain-name.com/with/some/very/long/pathurl = ( FOR MAXIMUM COMPLEXITY --max-complexity= |
This issue is about the length of files, not individual lines. I.e. we want flake8 to yell if a file has more than X lines of code. |
Hello, does the limit pertain to physical lines or logical lines? For example,
The above should be one logical line, and four physical lines. |
Physical lines is sufficient, logical lines is better. |
Thanks :-) |
...And to be very sure, the lines which count should not be comments or docstrings.... |
I don't have a strong opinion. I propose to make the first version simple and dump: Count all physical lines. And then work from there when we see how people use it. |
Can we create a plugin that accepts the parameter
"lines" which will provide with a list of strings representing all
of the lines in the file (including empty/blank lines). We can then
call "len(lines)" and return an violation if that exceeds 500.
…Sent from my iPhone
On 26 May 2019, at 1:00 PM, Nejc Zupan ***@***.***> wrote:
I don't have a strong opinion. I propose to make the first version simple and dump: Count all physical lines. And then work from there when we see how people use it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I don’t know how flake8 plugin machinery works, so I can’t answer this.
… On 26 May 2019, at 14:38, Oscar Chidi Anomnihe ***@***.***> wrote:
Can we create a plugin that accepts the parameter
"lines" which will provide with a list of strings representing all
of the lines in the file (including empty/blank lines). We can then
call "len(lines)" and return an violation if that exceeds 500.
Sent from my iPhone
On 26 May 2019, at 1:00 PM, Nejc Zupan ***@***.*** ***@***.***>> wrote:
> I don't have a strong opinion. I propose to make the first version simple and dump: Count all physical lines. And then work from there when we see how people use it.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub <#7>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AIT5BW4YGTWTCDMTSTBI3WLPXJ3VZANCNFSM4GRHH3BQ>.
>
Related to candidate from Niteo
Oscar Chidi Anomnihe
Open candidate profile <https://app.recruitee.com/#dashboard/overview?candidate=9602237&company=31171>
|
I was lending an opinion... so we work on it as we are to create a customized plugin. I have researched and found out we have to create one ourselves.
…Sent from my iPhone
On 26 May 2019, at 1:50 PM, Nejc Zupan ***@***.***> wrote:
I don’t know how flake8 plugin machinery works, so I can’t answer this.
> On 26 May 2019, at 14:38, Oscar Chidi Anomnihe ***@***.***> wrote:
>
> Can we create a plugin that accepts the parameter
> "lines" which will provide with a list of strings representing all
> of the lines in the file (including empty/blank lines). We can then
> call "len(lines)" and return an violation if that exceeds 500.
>
> Sent from my iPhone
>
> On 26 May 2019, at 1:00 PM, Nejc Zupan ***@***.***> wrote:
>
>> I don't have a strong opinion. I propose to make the first version simple and dump: Count all physical lines. And then work from there when we see how people use it.
>>
>> —
>> You are receiving this because you commented.
>> Reply to this email directly, view it on GitHub, or mute the thread.
>>
>
> Related to candidate from Niteo
> Oscar Chidi Anomnihe
> Open candidate profile
|
Alright. I am working on it. |
Maybe try using a simple code with Boolean
Def code_limit():
Lines =[] # a list of str representing lines
For i in len(Lines):
If i >500
print(“ maximum limit of code reached”)
…Sent from my iPhone
On 26 May 2019, at 2:01 PM, ayivima ***@***.***> wrote:
I don't have a strong opinion. I propose to make the first version simple and dump: Count all physical lines. And then work from there when we see how people use it.
Alright. I working on it.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Check this guy out while working developing. It could be helpful too
https://github.com/ambv/flake8-mypy
Regards
…Sent from my iPhone
On 26 May 2019, at 2:06 PM, oscar anomnihe ***@***.***> wrote:
Maybe try using a simple code with Boolean
Def code_limit():
Lines =[] # a list of str representing lines
For i in len(Lines):
If i >500
print(“ maximum limit of code reached”)
Sent from my iPhone
> On 26 May 2019, at 2:01 PM, ayivima ***@***.***> wrote:
>
> I don't have a strong opinion. I propose to make the first version simple and dump: Count all physical lines. And then work from there when we see how people use it.
>
> Alright. I working on it.
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or mute the thread.
|
Alright, Thanks :-) |
I'd like to have a flake8 plugin that would yell at me if any of the files is longer than 500 lines of code.
The 500 should be configurable. The plugin should support overriding the limit per file or skipping the limit altogether.
https://flake8.pycqa.org/en/latest/user/using-plugins.html
The text was updated successfully, but these errors were encountered: