#27 clean up the code to make flake8 happy
Merged 7 years ago by mjia. Opened 7 years ago by mjia.
mjia/waiverdb cleanup_flake8  into  master

file modified
-2
@@ -164,7 +164,6 @@ 

  ]

  

  

- 

  # -- Options for Epub output ----------------------------------------------

  

  # Bibliographic Dublin Core info.
@@ -186,6 +185,5 @@ 

  epub_exclude_files = ['search.html']

  

  

- 

  # Example configuration for intersphinx: refer to the Python standard library.

  intersphinx_mapping = {'https://docs.python.org/': None}

file modified
-1
@@ -13,7 +13,6 @@ 

  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

  # GNU General Public License for more details.

  

- import os

  import socket

  

  hostname = socket.gethostname()

file modified
+1 -1
@@ -45,7 +45,7 @@ 

              'waived': True,

              'comment': 'it broke',

          }

-         r = client.post('/api/v1.0/waivers/',  data=json.dumps(data),

+         r = client.post('/api/v1.0/waivers/', data=json.dumps(data),

                          content_type='application/json',

                          headers={'Authorization': 'Negotiate CTOKEN'})

          assert r.status_code == 201

file modified
+4 -1
@@ -33,4 +33,7 @@ 

  [flake8]

  show-source = True

  max-line-length = 100

- exclude = .git,.tox,dist,*egg

+ exclude = .git,.tox,dist,*egg,env_waiverdb, *fedmsg.d

+ 

+ # E124: closing bracket does not match visual indentation

+ ignore = E124

I guess another option would be to just exclude setup.py as well, because it is kind of a special case like conf.py. But this is okay too I think.

file modified
+3 -3
@@ -30,6 +30,6 @@ 

          self.comment = comment

  

      def __repr__(self):

-         return '%s(result_id=%r, username=%r, product_version=%r, waived=%r)' % (

-                 self.__class__.__name__, self.result_id, self.username,

-                 self.product_version, self.waived)

+         return '%s(result_id=%r, username=%r, product_version=%r, waived=%r)' % \

Ugh I am surprised this is required by PEP8... a good example of where PEP8 is just wrong I think. Oh well...

Using format would solve the problem and looks much cleaner than either of these options.

+             (self.__class__.__name__, self.result_id, self.username, self.product_version,

+              self.waived)

no initial comment

This is better as it is now. The reason for the trailing comma, and closing parenthesis on a separate line, is to make the diff nicer when you add or remove entries in the dict. Can you just figure out whichever flake8 error code this is, and turn it off instead?

I guess these errors are good to report on normal code -- the issue is just in that conf.py which is really config and not code. Does flake8 have a way we can ignore these errors just in that file?

Ugh I am surprised this is required by PEP8... a good example of where PEP8 is just wrong I think. Oh well...

There is no way to disable these errors in a specific file. I guess we can exclude it instead.

rebased

7 years ago

Yeah excluding conf.py from flake8 entirely seems reasonable.

I guess another option would be to just exclude setup.py as well, because it is kind of a special case like conf.py. But this is okay too I think.

Pull-Request has been merged by mjia

7 years ago

Using format would solve the problem and looks much cleaner than either of these options.

@jcline that's a good point. It's my fault for being stuck in my old-school ways with %-formatting. :-)