commit:     b9a608b54d31deae83cac1d7143c245472211861
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Oct  9 23:12:06 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Oct  9 23:16:50 2015 +0000
URL:        https://gitweb.gentoo.org/proj/grss.git/commit/?id=b9a608b5

grs/Interpret.py: skip non-functional build lines

 grs/Interpret.py |  11 +-
 grs/zzz.lint     | 363 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 368 insertions(+), 6 deletions(-)

diff --git a/grs/Interpret.py b/grs/Interpret.py
index 072574e..43c0e48 100644
--- a/grs/Interpret.py
+++ b/grs/Interpret.py
@@ -161,9 +161,11 @@ class Interpret(Daemon):
             for _line in _file.readlines():
                 line_number += 1
 
-                # Skip lines with initial # as comments.
-                _match = re.search(r'^(#).*$', _line)
-                if _match:
+                # Do nothing for lines with initial # or blank lines.
+                # Create a progress stamp only if we are not doing an update 
run.
+                if re.search(r'^(#).*$', _line) or len(_line.strip()) == 0:
+                    if not self.update_run:
+                        stampit(progress)
                     continue
 
                 # For a release run, execute every line of the build script.
@@ -198,9 +200,6 @@ class Interpret(Daemon):
                 # build script are implemented.  Note: 'hashit' can only come
                 # after 'tarit' or 'isoit' so that it knows the medium_name
                 # to hash, ie whether its a .tar.xz or a .iso
-                if verb == '':
-                    stampit(progress)
-                    continue
                 if verb == 'log':
                     if smartlog(_line, obj, True):
                         stampit(progress)

diff --git a/grs/zzz.lint b/grs/zzz.lint
new file mode 100644
index 0000000..f2845ed
--- /dev/null
+++ b/grs/zzz.lint
@@ -0,0 +1,363 @@
+************* Module grs
+C:  1, 0: Missing module docstring (missing-docstring)
+************* Module grs.Daemon
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 48, 4: Missing method docstring (missing-docstring)
+C: 89, 4: Missing method docstring (missing-docstring)
+C: 93, 4: Missing method docstring (missing-docstring)
+C: 97, 4: Missing method docstring (missing-docstring)
+************* Module grs.Interpret
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 42, 4: Too many local variables (34/15) (too-many-locals)
+E: 58,39: Instance of 'Interpret' has no 'subcgroupdir' member (no-member)
+W: 67,32: Unused variable 'i' (unused-variable)
+W: 50,28: Unused argument 'frame' (unused-argument)
+E: 92,15: Instance of 'Interpret' has no 'mock_run' member (no-member)
+E:110,35: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:111,37: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:112,27: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:113,31: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:114,33: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:115,31: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:116,33: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:117,33: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:118,39: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:119,55: Instance of 'Interpret' has no 'run_number' member (no-member)
+E:146,43: Instance of 'Interpret' has no 'update_run' member (no-member)
+E:152,48: Instance of 'Interpret' has no 'update_run' member (no-member)
+E:175,35: Instance of 'Interpret' has no 'update_run' member (no-member)
+E:179,23: Instance of 'Interpret' has no 'update_run' member (no-member)
+R: 42, 4: Too many branches (38/12) (too-many-branches)
+R: 42, 4: Too many statements (134/50) (too-many-statements)
+************* Module grs.Synchronize
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 32, 4: Missing method docstring (missing-docstring)
+************* Module grs.RunScript
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 35, 4: Missing method docstring (missing-docstring)
+R: 24, 0: Too few public methods (1/2) (too-few-public-methods)
+************* Module grs.MountDirectories
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 50, 4: Method could be a function (no-self-use)
+W: 86,22: Unused variable 'all_mounted' (unused-variable)
+************* Module grs.Rotator
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 27, 4: Method could be a function (no-self-use)
+************* Module grs.PivotChroot
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 38, 4: Missing method docstring (missing-docstring)
+************* Module grs.HashIt
+C:  1, 0: Missing module docstring (missing-docstring)
+E: 36,30: Instance of 'HashIt' has no 'portage_configroot' member (no-member)
+E: 40,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 41,28: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 42,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 45,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 46,29: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 47,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 50,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 51,31: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 52,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 55,29: Instance of 'HashIt' has no 'digest_name' member (no-member)
+E: 56,35: Instance of 'HashIt' has no 'medium_name' member (no-member)
+E: 57,41: Instance of 'HashIt' has no 'digest_name' member (no-member)
+R: 22, 0: Too few public methods (1/2) (too-few-public-methods)
+************* Module grs.ISOIt
+W: 84, 0: TODO: we are assuming a static busybox, so we should check. (fixme)
+W: 97, 0: TODO: we are assuming a static kernel and so not copying in (fixme)
+W:125, 0: TODO: we are assuming a static kernel (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 26, 0: Too many instance attributes (9/7) (too-many-instance-attributes)
+R: 29, 4: Too many arguments (6/5) (too-many-arguments)
+R: 45, 4: Too many local variables (19/15) (too-many-locals)
+C:110, 4: Missing method docstring (missing-docstring)
+************* Module grs.Kernel
+W:111, 0: TODO: add more options (eg splash and firmware), which can be (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 30, 4: Too many arguments (6/5) (too-many-arguments)
+R: 72, 4: Too many local variables (20/15) (too-many-locals)
+W:133,21: Unused variable 'dirnames' (unused-variable)
+************* Module grs.Log
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 18, 4: Missing method docstring (missing-docstring)
+C: 28, 4: Missing method docstring (missing-docstring)
+************* Module grs.WorldConf
+W: 29, 0: TODO: This needs to be expanded. (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 66, 4: Too many local variables (18/15) (too-many-locals)
+E: 71,17: Module 'portage' has no 'db' member (no-member)
+E: 71,28: Module 'portage' has no 'root' member (no-member)
+E: 72,16: Module 'portage' has no 'db' member (no-member)
+E: 72,27: Module 'portage' has no 'root' member (no-member)
+W:105,21: Unused variable 'dirnames' (unused-variable)
+************* Module grs.Constants
+C:  1, 0: Missing module docstring (missing-docstring)
+C:153, 0: Invalid attribute name "LIBDIR" (invalid-name)
+C:159, 0: Invalid attribute name "PORTAGE_CONFIGROOT" (invalid-name)
+C:158, 0: Invalid attribute name "KERNELROOT" (invalid-name)
+C:167, 0: Invalid attribute name "GRS_CGROUPDIR" (invalid-name)
+C:145, 0: Invalid attribute name "PACKAGE_NAME" (invalid-name)
+C:155, 0: Invalid attribute name "TMPDIR" (invalid-name)
+C:165, 0: Invalid attribute name "WORLD_CONFIG" (invalid-name)
+C:148, 0: Invalid attribute name "BUG_REPORTS" (invalid-name)
+C:154, 0: Invalid attribute name "LOGFILE" (invalid-name)
+C:163, 0: Invalid attribute name "PORTAGE_CONFIGDIR" (invalid-name)
+C:147, 0: Invalid attribute name "PACKAGE_DESCRIPTION" (invalid-name)
+C:160, 0: Invalid attribute name "PIDFILE" (invalid-name)
+C:156, 0: Invalid attribute name "WORKDIR" (invalid-name)
+C:146, 0: Invalid attribute name "PACKAGE_VERSION" (invalid-name)
+C:164, 0: Invalid attribute name "PORTAGE_DIRTYFILE" (invalid-name)
+C:157, 0: Invalid attribute name "PACKAGE" (invalid-name)
+C:166, 0: Invalid attribute name "GRS_CGROUP" (invalid-name)
+R: 24, 0: Too many instance attributes (19/7) (too-many-instance-attributes)
+W:153, 0: Attribute 'LIBDIR' defined outside __init__ 
(attribute-defined-outside-init)
+W:159, 0: Attribute 'PORTAGE_CONFIGROOT' defined outside __init__ 
(attribute-defined-outside-init)
+W:158, 0: Attribute 'KERNELROOT' defined outside __init__ 
(attribute-defined-outside-init)
+W:167, 0: Attribute 'GRS_CGROUPDIR' defined outside __init__ 
(attribute-defined-outside-init)
+W:145, 0: Attribute 'PACKAGE_NAME' defined outside __init__ 
(attribute-defined-outside-init)
+W:155, 0: Attribute 'TMPDIR' defined outside __init__ 
(attribute-defined-outside-init)
+W:165, 0: Attribute 'WORLD_CONFIG' defined outside __init__ 
(attribute-defined-outside-init)
+W:148, 0: Attribute 'BUG_REPORTS' defined outside __init__ 
(attribute-defined-outside-init)
+W:154, 0: Attribute 'LOGFILE' defined outside __init__ 
(attribute-defined-outside-init)
+W:163, 0: Attribute 'PORTAGE_CONFIGDIR' defined outside __init__ 
(attribute-defined-outside-init)
+W:147, 0: Attribute 'PACKAGE_DESCRIPTION' defined outside __init__ 
(attribute-defined-outside-init)
+W:160, 0: Attribute 'PIDFILE' defined outside __init__ 
(attribute-defined-outside-init)
+W:156, 0: Attribute 'WORKDIR' defined outside __init__ 
(attribute-defined-outside-init)
+W:146, 0: Attribute 'PACKAGE_VERSION' defined outside __init__ 
(attribute-defined-outside-init)
+W:164, 0: Attribute 'PORTAGE_DIRTYFILE' defined outside __init__ 
(attribute-defined-outside-init)
+W:157, 0: Attribute 'PACKAGE' defined outside __init__ 
(attribute-defined-outside-init)
+W:166, 0: Attribute 'GRS_CGROUP' defined outside __init__ 
(attribute-defined-outside-init)
+R: 24, 0: Too few public methods (0/2) (too-few-public-methods)
+************* Module grs.Execute
+C:  1, 0: Missing module docstring (missing-docstring)
+W: 30, 4: Dangerous default value {} as argument (dangerous-default-value)
+R: 30, 4: Too many arguments (7/5) (too-many-arguments)
+C: 45, 8: Missing function docstring (missing-docstring)
+W: 50,20: Unused variable 'i' (unused-variable)
+R: 27, 0: Too few public methods (0/2) (too-few-public-methods)
+************* Module grs.Populate
+C:  1, 0: Missing module docstring (missing-docstring)
+W: 68,21: Unused variable 'dirnames' (unused-variable)
+************* Module grs.Seed
+C:  1, 0: Missing module docstring (missing-docstring)
+R: 31, 4: Too many arguments (6/5) (too-many-arguments)
+C: 43, 4: Missing method docstring (missing-docstring)
+************* Module grs.TarIt
+W: 48, 0: TODO: This needs to be generalized for systems that don't support 
xattrs (fixme)
+C:  1, 0: Missing module docstring (missing-docstring)
+C: 39, 4: Missing method docstring (missing-docstring)
+R:  1, 0: Similar lines in 2 files
+==grs.Execute:48
+==grs.Interpret:65
+            try:
+                for i in range(10):
+                    os.kill(pid, signal.SIGTERM)
+                    time.sleep(0.2)
+                while True:
+                    os.kill(pid, signal.SIGKILL)
+                    time.sleep(0.2)
+            except ProcessLookupError:
+                pass (duplicate-code)
+R:  1, 0: Similar lines in 2 files
+==grs.ISOIt:34
+==grs.TarIt:28
+        self.portage_configroot = portage_configroot
+        self.logfile = logfile
+        # Prepare a year, month and day for a tarball name timestamp.
+        self.year = str(datetime.now().year).zfill(4)
+        self.month = str(datetime.now().month).zfill(2)
+        self.day = str(datetime.now().day).zfill(2) (duplicate-code)
+R:  1, 0: Similar lines in 2 files
+==grs.Interpret:26
+==grs:23
+from grs.ISOIt import ISOIt
+from grs.Log import Log
+from grs.Kernel import Kernel
+from grs.MountDirectories import MountDirectories
+from grs.PivotChroot import PivotChroot
+from grs.Populate import Populate (duplicate-code)
+
+
+Report
+======
+877 statements analysed.
+
+Statistics by type
+------------------
+
++---------+-------+-----------+-----------+------------+---------+
+|type     |number |old number |difference |%documented |%badname |
++=========+=======+===========+===========+============+=========+
+|module   |18     |18         |=          |0.00        |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|class    |17     |17         |=          |100.00      |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|method   |44     |44         |=          |72.73       |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+|function |4      |4          |=          |75.00       |0.00     |
++---------+-------+-----------+-----------+------------+---------+
+
+
+
+External dependencies
+---------------------
+::
+
+    grs 
+      \-Constants 
(grs.RunScript,grs.Interpret,grs,grs.Kernel,grs.WorldConf,grs.ISOIt,grs.Seed,grs.Synchronize,grs.Execute,grs.TarIt,grs.MountDirectories,grs.Populate,grs.PivotChroot,grs.Log)
+      \-Daemon (grs.Interpret,grs)
+      \-Execute 
(grs.RunScript,grs,grs.Kernel,grs.ISOIt,grs.Seed,grs.Synchronize,grs.TarIt,grs.MountDirectories,grs.HashIt,grs.Populate)
+      \-HashIt (grs.ISOIt,grs,grs.TarIt)
+      \-ISOIt (grs.Interpret,grs)
+      \-Interpret (grs)
+      \-Kernel (grs.Interpret,grs)
+      \-Log (grs.Interpret,grs)
+      \-MountDirectories (grs.Interpret,grs)
+      \-PivotChroot (grs.Interpret,grs)
+      \-Populate (grs.Interpret,grs)
+      \-Rotator (grs.Log,grs.Seed,grs,grs.PivotChroot)
+      \-RunScript (grs.Interpret,grs)
+      \-Seed (grs.Interpret,grs)
+      \-Synchronize (grs.Interpret,grs)
+      \-WorldConf (grs)
+    portage (grs.WorldConf)
+
+
+
+Raw metrics
+-----------
+
++----------+-------+------+---------+-----------+
+|type      |number |%     |previous |difference |
++==========+=======+======+=========+===========+
+|code      |951    |56.47 |951      |=          |
++----------+-------+------+---------+-----------+
+|docstring |175    |10.39 |175      |=          |
++----------+-------+------+---------+-----------+
+|comment   |422    |25.06 |422      |=          |
++----------+-------+------+---------+-----------+
+|empty     |136    |8.08  |136      |=          |
++----------+-------+------+---------+-----------+
+
+
+
+Duplication
+-----------
+
++-------------------------+------+---------+-----------+
+|                         |now   |previous |difference |
++=========================+======+=========+===========+
+|nb duplicated lines      |21    |21       |=          |
++-------------------------+------+---------+-----------+
+|percent duplicated lines |1.186 |1.186    |=          |
++-------------------------+------+---------+-----------+
+
+
+
+Messages by category
+--------------------
+
++-----------+-------+---------+-----------+
+|type       |number |previous |difference |
++===========+=======+=========+===========+
+|convention |48     |48       |=          |
++-----------+-------+---------+-----------+
+|refactor   |21     |21       |=          |
++-----------+-------+---------+-----------+
+|warning    |31     |31       |=          |
++-----------+-------+---------+-----------+
+|error      |33     |33       |=          |
++-----------+-------+---------+-----------+
+
+
+
+% errors / warnings by module
+-----------------------------
+
++---------------------+------+--------+---------+-----------+
+|module               |error |warning |refactor |convention |
++=====================+======+========+=========+===========+
+|grs.Interpret        |48.48 |6.45    |14.29    |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.HashIt           |39.39 |0.00    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.WorldConf        |12.12 |6.45    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Constants        |0.00  |54.84   |9.52     |37.50      |
++---------------------+------+--------+---------+-----------+
+|grs.ISOIt            |0.00  |9.68    |14.29    |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.Execute          |0.00  |6.45    |9.52     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.Kernel           |0.00  |6.45    |9.52     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.TarIt            |0.00  |3.23    |14.29    |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.MountDirectories |0.00  |3.23    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Populate         |0.00  |3.23    |0.00     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Seed             |0.00  |0.00    |4.76     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.RunScript        |0.00  |0.00    |4.76     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.Rotator          |0.00  |0.00    |4.76     |2.08       |
++---------------------+------+--------+---------+-----------+
+|grs.Daemon           |0.00  |0.00    |0.00     |10.42      |
++---------------------+------+--------+---------+-----------+
+|grs.Log              |0.00  |0.00    |0.00     |6.25       |
++---------------------+------+--------+---------+-----------+
+|grs.Synchronize      |0.00  |0.00    |0.00     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs.PivotChroot      |0.00  |0.00    |0.00     |4.17       |
++---------------------+------+--------+---------+-----------+
+|grs                  |0.00  |0.00    |0.00     |2.08       |
++---------------------+------+--------+---------+-----------+
+
+
+
+Messages
+--------
+
++-------------------------------+------------+
+|message id                     |occurrences |
++===============================+============+
+|no-member                      |33          |
++-------------------------------+------------+
+|missing-docstring              |31          |
++-------------------------------+------------+
+|invalid-name                   |17          |
++-------------------------------+------------+
+|attribute-defined-outside-init |17          |
++-------------------------------+------------+
+|unused-variable                |6           |
++-------------------------------+------------+
+|fixme                          |6           |
++-------------------------------+------------+
+|too-many-locals                |4           |
++-------------------------------+------------+
+|too-many-arguments             |4           |
++-------------------------------+------------+
+|too-few-public-methods         |4           |
++-------------------------------+------------+
+|duplicate-code                 |3           |
++-------------------------------+------------+
+|too-many-instance-attributes   |2           |
++-------------------------------+------------+
+|no-self-use                    |2           |
++-------------------------------+------------+
+|unused-argument                |1           |
++-------------------------------+------------+
+|too-many-statements            |1           |
++-------------------------------+------------+
+|too-many-branches              |1           |
++-------------------------------+------------+
+|dangerous-default-value        |1           |
++-------------------------------+------------+
+
+
+
+Global evaluation
+-----------------
+Your code has been rated at 6.98/10 (previous run: 6.98/10, +0.00)
+

Reply via email to