melexis / sphinx-coverity-extension

Sphinx plugin to generate Coverity defects report or table in reStructuredText documentation. Coverity report is then personally styled while data integrity is guaranteed.
GNU General Public License v3.0
5 stars 2 forks source link

Login to server once, retrieve defects with each node #17

Closed Letme closed 5 years ago

Letme commented 5 years ago

We were logging in and retrieving stream and project information from coverity server with each node. This is not needed and is now done when builder initializes. It also enabled us to print nicer warning outputs when there was a login error, but we still do not fail build with it. It is up for external tools (mlx.warnings) to error in case warnings are unwanted. It also means that in case you have plugin in conf.py, but you don't use it (no directives), it will not print errors or fail your builds.

When bad login credentials are provided:

Running Sphinx v1.8.3
Login to Coverity server... failed with: (401, 'Unauthorized')
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                             
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                                              
sphinx-coverity-extension/example/index.rst: WARNING: Connection failed: (401, 'Unauthorized')
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 1 warning.

The HTML pages are in _build/html.

Build finished. The HTML pages are in _build/html.

When stream is wrong:

Running Sphinx v1.8.3
Login to Coverity server... done
obtaining stream information... failed with: No such Coverity stream [fail] found on [http://coverity.melexis.com:8080]
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index                                                                                                                                                                             
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index                                                                                                                                                                              
sphinx-coverity-extension/example/index.rst: WARNING: Connection failed: No such Coverity stream [fail] found on [http://coverity.urlname]
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in English (code: en) ... done
dumping object inventory... done
build succeeded, 1 warning.

The HTML pages are in _build/html.

Build finished. The HTML pages are in _build/html.

I only moved initialize_environment and process_coverity_nodes into common class SphinxCoverityConnector which makes sure that coverty_service and project_name variables are shared. Because of that I also was able to move error handling (initialized in init), which now prints login failed information at node position in document (so in case there are no nodes and plugin fails, we also do not get any warnings).

Fixes #12

Fixes #16

codecov-io commented 5 years ago

Codecov Report

Merging #17 into master will increase coverage by 0.34%. The diff coverage is 4.44%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #17      +/-   ##
==========================================
+ Coverage   17.04%   17.39%   +0.34%     
==========================================
  Files           1        1              
  Lines         176      184       +8     
==========================================
+ Hits           30       32       +2     
- Misses        146      152       +6
Impacted Files Coverage Δ
mlx/coverity.py 17.39% <4.44%> (+0.34%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 32d8c20...3a9d573. Read the comment docs.