Skip to content

Conversation

@tpikonen
Copy link
Contributor

@tpikonen tpikonen commented Nov 3, 2022

I think it would be nice to have a stricter machine validated code style for gPodder (i.e. I started using autolinting on my editor and everything is red). This PR adds a flake8 config section to setup.cfg with ignores for some errors and warnings, and fixes (mostly automatically made) for some others.

There are still 157 flake8 errors in gPodder after the fixes and ignores, but it's a start. This is also probably really boring to review, but here goes.

@auouymous
Copy link
Member

LGTM. I'm going to test it for a week to make sure it doesn't cause any major issues.

It'll be nice to have flake8 run with make lint after we fix the remaining errors.

Copy link
Member

@elelay elelay left a comment

Choose a reason for hiding this comment

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

not sure about some removed imports

@elelay elelay self-requested a review November 7, 2022 15:22
Copy link
Member

@elelay elelay left a comment

Choose a reason for hiding this comment

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

good to go 👍
thanks for this work!

@tpikonen
Copy link
Contributor Author

tpikonen commented Nov 7, 2022

Squashed the fixup.

@auouymous
Copy link
Member

The following hunk was modified in #1382. Would it be easier to remove the hunk from this PR or rebase it in #1382?

@@ -621,8 +621,8 @@ def get_playback_url(self, config=None, allow_partial=False):
         """
         url = self.local_filename(create=False)
 
-        if (allow_partial and url is not None and
-                os.path.exists(url + '.partial')):
+        if (allow_partial and url is not None
+                and os.path.exists(url + '.partial')):
             return url + '.partial'
 
         if url is None or not os.path.exists(url):

@auouymous
Copy link
Member

And the following hunk was modified in #1374.

@@ -17,7 +17,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-from gi.repository import Gdk, GdkPixbuf, Gtk
+from gi.repository import Gdk, Gtk
 
 import gpodder
 from gpodder import util

@tpikonen
Copy link
Contributor Author

tpikonen commented Nov 8, 2022

The following hunk was modified in #1382. Would it be easier to remove the hunk from this PR or rebase it in #1382?

I can rebase this to master and fix these after #1382 is merged.

Set project-wide max-line-length and ignore indentation errors E126 and
E128, and warning W503 (Line break occurred before a binary operator)
for now.
Fixes flake8 error F401.
Most errors were fixed by running

autoflake -i -r --remove-all-unused-imports .

which also removes unnecessary 'pass' statements, some by hand-editing.
Fixed by running

autopep8 -i -r --select=W504 .

and some hand tuning.
@tpikonen
Copy link
Contributor Author

Rebased to master and fixed the conflicts.

@auouymous auouymous merged commit a815c34 into gpodder:master Nov 14, 2022
@auouymous
Copy link
Member

Thank you for adding this.

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.

3 participants