From 112fc59ac6b640513acad9636c0b3b85859f57ee Mon Sep 17 00:00:00 2001 From: Peter Wilmott
Date: Mon, 22 Jun 2015 20:12:03 +0100 Subject: Fix remaining issues raised by pylint --- bin/packages.py | 18 +++++++++--------- web/.pylintrc | 5 +++++ web/Rakefile | 6 +++++- 3 files changed, 19 insertions(+), 10 deletions(-) create mode 100644 web/.pylintrc diff --git a/bin/packages.py b/bin/packages.py index fc464e9..735eb54 100755 --- a/bin/packages.py +++ b/bin/packages.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import portage, hashlib +import hashlib, portage def format_deps(dep_list): for item in list(dep_list): @@ -35,7 +35,7 @@ def get_deps(cpv): def format_output(cpv, slot, iuse, keyword): category, pkgname, version, revision = portage.catpkgsplit(cpv) - sha1 = hashlib.sha1(open(porttree.dbapi.findname(cpv), 'rb').read()).hexdigest() + sha1 = hashlib.sha1(open(PORTTREE.dbapi.findname(cpv), 'rb').read()).hexdigest() print(sha1 + ' ' + \ category + ' ' + \ pkgname + ' ' + \ @@ -64,23 +64,23 @@ def format_output(cpv, slot, iuse, keyword): print() -porttree = portage.db[portage.root]['porttree'] -for cp in porttree.dbapi.cp_all(): +PORTTREE = portage.db[portage.root]['PORTTREE'] +for cp in PORTTREE.dbapi.cp_all(): slot_dict = {} - for cpv in porttree.dbapi.cp_list(cp): - slot, iuse = porttree.dbapi.aux_get(cpv, ['SLOT', 'IUSE']) + for cpv in PORTTREE.dbapi.cp_list(cp): + slot, iuse = PORTTREE.dbapi.aux_get(cpv, ['SLOT', 'IUSE']) slot_dict.setdefault(slot, {})[cpv] = (iuse) for slot, cpvd in slot_dict.items(): if 'ruby_targets_' in iuse: - cpvbs = (porttree.dep_bestmatch(cp)) + cpvbs = (PORTTREE.dep_bestmatch(cp)) if cpvbs: - slot, iuse, keywords = porttree.dbapi.aux_get(cpvbs, ['SLOT', 'IUSE', 'KEYWORDS']) + slot, iuse, keywords = PORTTREE.dbapi.aux_get(cpvbs, ['SLOT', 'IUSE', 'KEYWORDS']) if '~amd64' not in keywords and 'amd64' in keywords: format_output(cpvbs, slot, iuse, 'amd64') cpvbu = portage.best(list(cpvd)) if cpvbu: - slot, iuse, keywords = porttree.dbapi.aux_get(cpvbu, ['SLOT', 'IUSE', 'KEYWORDS']) + slot, iuse, keywords = PORTTREE.dbapi.aux_get(cpvbu, ['SLOT', 'IUSE', 'KEYWORDS']) if '~amd64' in keywords: format_output(cpvbu, slot, iuse, '~amd64') diff --git a/web/.pylintrc b/web/.pylintrc new file mode 100644 index 0000000..931865c --- /dev/null +++ b/web/.pylintrc @@ -0,0 +1,5 @@ +[MESSAGES CONTROL] +disable=missing-docstring, no-member, redefined-outer-name + +[REPORTS] +reports=no diff --git a/web/Rakefile b/web/Rakefile index 066d7a2..e6ab09c 100644 --- a/web/Rakefile +++ b/web/Rakefile @@ -4,9 +4,13 @@ task default: 'test' desc 'Run the test suite' task :test do + puts "RUBOCOP:\n" sh 'bundle exec rubocop' + puts "\nSHELLCHECK:\n" sh "shellcheck --exclude=SC2016 #{Dir.glob('../**/*.sh').join(' ')}" - sh "pylint --reports=n #{Dir.glob('../**/*.py').join(' ')}" + puts "\nPYLINT:\n" + sh "pylint --rcfile=.pylintrc #{Dir.glob('../**/*.py').join(' ')}" + puts "\nMINITEST:" Dir.glob('./test/test_*.rb') { |f| require f } end -- cgit v1.2.3-65-gdbad