Fix flake8 issues (#3834)

* Fix flake8 whitespace reports

$ flake8 | grep -E '(E203|E221|E226|E303|W291|W293)'
./mesonbuild/coredata.py:337:5: E303 too many blank lines (2)

* Fix flake8 'variable assigned value but unused' reports

$ flake8 | grep -E F841
./mesonbuild/modules/gnome.py:922:9: F841 local variable 'target_name' is assigned to but never used

* Fix flake8 'imported but unused' reports

$ flake8 | grep F401
./mesonbuild/compilers/__init__.py:128:1: F401 '.c.ArmclangCCompiler' imported but unused
./mesonbuild/compilers/__init__.py:138:1: F401 '.cpp.ArmclangCPPCompiler' imported but unused
./mesonbuild/modules/__init__.py:4:1: F401 '..mlog' imported but unused

PR #3717 imports ARMCLANG compilers in __init__, but does not add them to
__all__, so they are not re-exported by the compilers package like
everything else.

* More details about flake8 in Contributing.md

Mention that Sider runs flake8
Suggest seting flake8 as a pre-commit hook
pull/3840/head
Jon Turney 7 years ago committed by Nirbheek Chauhan
parent 8893d03703
commit b387ab1ee1
  1. 9
      docs/markdown/Contributing.md
  2. 2
      mesonbuild/compilers/__init__.py
  3. 1
      mesonbuild/coredata.py
  4. 1
      mesonbuild/modules/__init__.py
  5. 1
      mesonbuild/modules/gnome.py

@ -167,6 +167,8 @@ Continuous integration systems currently used:
allows `[skip ci]` anywhere in the commit messages.
- [AppVeyor](https://www.appveyor.com/docs/how-to/filtering-commits/#skip-directive-in-commit-message)
requires `[skip ci]` or `[skip appveyor]` in the commit title.
- [Sider](https://sider.review)
runs Flake8 (see below)
## Documentation
@ -208,6 +210,13 @@ $ cd meson
$ flake8
```
To run it automatically before committing:
```console
$ flake8 --install-hook=git
$ git config --bool flake8.strict true
```
## C/C++ coding style
Meson has a bunch of test code in several languages. The rules for

@ -46,6 +46,8 @@ __all__ = [
'ArmCCompiler',
'ArmCPPCompiler',
'ArmclangCCompiler',
'ArmclangCPPCompiler',
'CCompiler',
'ClangCCompiler',
'ClangCompiler',

@ -333,7 +333,6 @@ class CoreData:
'Default project to execute in Visual Studio',
'')
def get_builtin_option(self, optname):
if optname in self.builtins:
return self.builtins[optname].value

@ -1,7 +1,6 @@
import os
from .. import build
from .. import mlog
class ExtensionModule:

@ -919,7 +919,6 @@ This will become a hard error in the future.''')
raise MesonException('gdbus_codegen takes at most two arguments, name and xml file.')
namebase = args[0]
xml_files = args[1:]
target_name = namebase + '-gdbus'
cmd = [self.interpreter.find_program_impl('gdbus-codegen')]
extra_args = mesonlib.stringlistify(kwargs.pop('extra_args', []))
cmd += extra_args

Loading…
Cancel
Save