Skip to content

Commit

Permalink
Merge pull request #74 from melexis/REST-API
Browse files Browse the repository at this point in the history
Use REST API to retrieve defects
  • Loading branch information
Letme authored Aug 23, 2024
2 parents 1b54c6f + 391e5fb commit 8f23ea8
Show file tree
Hide file tree
Showing 19 changed files with 1,275 additions and 1,009 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install build twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
python -m build
twine upload dist/*
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ recursive-include example Makefile
recursive-include tests *.py
recursive-include tests *.rst
recursive-include tests *.txt
recursive-include tests *.json

exclude example/.env.example
exclude .pylintrc
Expand Down
4 changes: 0 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ Example of custom credentials for the plugin:
coverity_credentials = {
'hostname': 'scan.coverity.com',
'port': '8080',
'transport': 'http',
'username': 'reporter',
'password': 'coverity',
'stream': 'some_coverity_stream',
Expand Down Expand Up @@ -134,8 +132,6 @@ The plugin itself holds a default config that can be used for any Coverity proje
coverity_credentials = {
'hostname': 'scan.coverity.com',
'port': '8080',
'transport': 'http',
'username': 'reporter',
'password': 'coverity',
'stream': 'some_coverity_stream',
Expand Down
8 changes: 8 additions & 0 deletions example/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ PYTHONWARNINGS?= default::DeprecationWarning
PAPER ?=
BUILDDIR ?= _build

# logging variables
DEBUG ?= 0
LOGLEVEL =? WARNING

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -E -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
ifeq (${DEBUG}, 1)
ALLSPHINXOPTS += -T
endif
# the i18n builder cannot share the environment and doctrees with the others
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

Expand Down Expand Up @@ -43,6 +50,7 @@ clean:
-rm -rf $(BUILDDIR)/*

html:
export LOGLEVEL=$(LOGLEVEL)
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
Expand Down
108 changes: 59 additions & 49 deletions example/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,16 @@
import mlx.coverity
import mlx.traceability
from decouple import config
import logging
from sphinx.util.logging import getLogger
from pkg_resources import get_distribution

pkg_version = get_distribution('mlx.coverity').version
pkg_version = get_distribution("mlx.coverity").version

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath('../mlx'))
sys.path.insert(0, os.path.abspath("../mlx"))

# -- General configuration -----------------------------------------------------

Expand All @@ -34,34 +36,34 @@
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.coverage',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.graphviz',
'mlx.traceability',
'mlx.coverity',
'sphinx_selective_exclude.eager_only',
'sphinx_selective_exclude.modindex_exclude',
'sphinx_selective_exclude.search_auto_exclude'
"sphinx.ext.autodoc",
"sphinx.ext.doctest",
"sphinx.ext.coverage",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"sphinx.ext.graphviz",
"mlx.traceability",
"mlx.coverity",
"sphinx_selective_exclude.eager_only",
"sphinx_selective_exclude.modindex_exclude",
"sphinx_selective_exclude.search_auto_exclude",
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]

# The suffix of source filenames.
source_suffix = '.rst'
source_suffix = ".rst"

# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'
master_doc = "index"

# General information about the project.
project = u'Example'
copyright = u'2017, Stein Heselmans'
project = "Example"
copyright = "2017, Stein Heselmans"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand All @@ -84,7 +86,7 @@

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
exclude_patterns = ["_build"]

# The reST default role (used for this markup: `text`) to use for all documents.
#default_role = None
Expand All @@ -101,7 +103,7 @@
#show_authors = False

# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
pygments_style = "sphinx"

# A list of ignored prefixes for module index sorting.
#modindex_common_prefix = []
Expand All @@ -111,7 +113,7 @@

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down Expand Up @@ -140,8 +142,8 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']
html_static_path.append(os.path.join(os.path.dirname(mlx.traceability.__file__), 'assets'))
html_static_path = ["_static"]
html_static_path.append(os.path.join(os.path.dirname(mlx.traceability.__file__), "assets"))

# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
Expand Down Expand Up @@ -185,25 +187,22 @@
#html_file_suffix = None

# Output file base name for HTML help builder.
htmlhelp_basename = 'Exampledoc'
htmlhelp_basename = "Exampledoc"

# -- Options for LaTeX output --------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
'papersize': 'a4paper',

"papersize": "a4paper",
# The font size ('10pt', '11pt' or '12pt').
'pointsize': '10pt',

"pointsize": "10pt",
# Additional stuff for the LaTeX preamble.
'preamble': r'\setcounter{tocdepth}{3}\usepackage{pdflscape}',
"preamble": r"\setcounter{tocdepth}{3}\usepackage{pdflscape}",
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'Example.tex', u'Example Documentation',
u'Crt Mori', 'manual'),
("index", "Example.tex", "Example Documentation", "Crt Mori", "manual"),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -231,10 +230,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'example', u'Example Documentation',
[u'Crt Mori'], 1)
]
man_pages = [("index", "example", "Example Documentation", ["Crt Mori"], 1)]

# If true, show URL addresses after external links.
#man_show_urls = False
Expand All @@ -246,9 +242,15 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'Example', u'Example Documentation',
u'Crt Mori', 'Example', 'One line description of project.',
'Miscellaneous'),
(
"index",
"Example",
"Example Documentation",
"Crt Mori",
"Example",
"One line description of project.",
"Miscellaneous",
),
]

# Documents to append as an appendix to all manuals.
Expand All @@ -264,10 +266,10 @@
# -- Options for Epub output ---------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = u'Example'
epub_author = u'Crt Mori'
epub_publisher = u'Melexis'
epub_copyright = u'2018, Crt Mori'
epub_title = "Example"
epub_author = "Crt Mori"
epub_publisher = "Melexis"
epub_copyright = "2018, Crt Mori"

# The language of the text. It defaults to the language option
# or en if the language is not set.
Expand Down Expand Up @@ -305,17 +307,25 @@


# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
intersphinx_mapping = {"http://docs.python.org/": None}

# -- Options for coverity extension ----------------------------------------
coverity_credentials = {
'transport': 'http',
'port': '8080',
'hostname': 'coverity.melexis.com',
'username': config('COVERITY_USERNAME'),
'password': config('COVERITY_PASSWORD'),
'stream': config('COVERITY_STREAM'),
"hostname": "coverity.melexis.com",
"username": config("COVERITY_USERNAME"),
"password": config("COVERITY_PASSWORD"),
"stream": config("COVERITY_STREAM"),
}

TRACEABILITY_ITEM_ID_REGEX = r"([A-Z_]+-[A-Z0-9_]+)"
TRACEABILITY_ITEM_RELINK = {}

log_level = os.environ.get('LOGLEVEL', None)
if log_level:
try:
numeric_level = getattr(logging, log_level.upper(), None)
logger = getLogger("mlx.coverity_logging")
logger.setLevel(level=numeric_level)
except:
raise ValueError(f"Invalid log level: {log_level}")

2 changes: 1 addition & 1 deletion mlx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__import__('pkg_resources').declare_namespace(__name__)
__import__("pkg_resources").declare_namespace(__name__)
Loading

0 comments on commit 8f23ea8

Please sign in to comment.