# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['sarif', 'sarif.cmdline', 'sarif.operations']

package_data = \
{'': ['*'], 'sarif.operations': ['templates/*']}

install_requires = \
['jinja2>=3.1.2,<4.0.0',
 'matplotlib>=3.5.1,<4.0.0',
 'python-docx>=0.8.11,<0.9.0']

entry_points = \
{'console_scripts': ['sarif = sarif.cmdline.main:main']}

setup_kwargs = {
    'name': 'sarif-tools',
    'version': '1.0.0',
    'description': 'SARIF tools',
    'long_description': '# SARIF Tools\n\nA set of command line tools and Python library for working with SARIF files.\n\nRead more about the SARIF format here: https://sarifweb.azurewebsites.net/\n\n# Installation\n\n## Prerequisites\n\nYou need Python 3.8 or later installed.  Get it from [python.org](https://www.python.org/downloads/).  This document assumes that the `python` command runs that version.\n\n## Installing on Windows\n\nOpen an Admin Command Prompt (Start > Command Prompt > Run as Administrator) and type:\n```\npip install sarif-tools\n```\n\n## Installing on Linux or Mac\n\n```\nsudo pip install sarif-tools\n```\n\n## Testing the installation\n\nAfter installing using `pip`, you should then be able to run:\n```\nsarif --version\n```\n\n## Troubleshooting installation\n\nThis section has suggestions in case the `sarif` command is not available after installation.\n\nA launcher called `sarif` or `sarif.exe` is created in the Python installation\'s `Scripts` directory.  The `Scripts` directory needs to be in the `PATH`\nenvironment variable for you to be able to type `sarif` at the command prompt; this is most likely the case if `pip` is run as a\nsuper-user when installing (e.g. Administrator Command Prompt on Windows, or using `sudo` on Linux).\n\nIf the `Scripts` directory is not in the `PATH`, then you need to type `python -m sarif` instead of `sarif` to run the tool.\n\nConfusion can arise when the `python` and `pip` commands on the `PATH` are from different installations, or the `python` installation on the super-user\'s `PATH` is different from the `python` command on the normal user\'s path.  On Windows, you can use `where python` and `where pip` in normal CMD and Admin CMD to see which installations are in use; on Linux, it\'s `which python` and `which pip` with and without `sudo`.\n\n# Command Line Usage\n\n```\nusage: sarif [-h] [--version] [--debug] [--check {error,warning,note}] {blame,copy,csv,diff,html,info,ls,summary,trend,usage,word} ...\n\nProcess sets of SARIF files\n\npositional arguments:\n  {blame,copy,csv,diff,html,info,ls,summary,trend,usage,word}\n                        command\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --version, -v         show program\'s version number and exit\n  --debug               Print information useful for debugging\n  --check {error,warning,note}, -x {error,warning,note}\n                        Exit with error code if there are any issues of the specified level (or for diff, an increase in issues at that level).\n\ncommands:\nblame    Enhance SARIF file with information from `git blame`\ncopy     Write a new SARIF file containing optionally-filtered data from other SARIF file(s)\ncsv      Write a CSV file listing the issues from the SARIF files(s) specified\ndiff     Find the difference between two [sets of] SARIF files\nhtml     Write an HTML representation of SARIF file(s) for viewing in a web browser\ninfo     Print information about SARIF file(s) structure\nls       List all SARIF files in the directories specified\nsummary  Write a text summary with the counts of issues from the SARIF files(s) specified\ntrend    Write a CSV file with time series data from SARIF files with "yyyymmddThhmmssZ" timestamps in their filenames\nusage    (Command optional) - print usage and exit\nword     Produce MS Word .docx summaries of the SARIF files specified\nRun `sarif <COMMAND> --help` for command-specific help.\n```\n\n## Commands\n\nThe commands are illustrated below assuming input files in the following locations:\n\n- `C:\\temp\\sarif_files` = a directory of SARIF files with arbitrary filenames.\n- `C:\\temp\\sarif_with_date` = a directory of SARIF files with filenames including timestamps e.g. `C:\\temp\\sarif_with_date\\myapp_devskim_output_20211001T012000Z.sarif`.\n- `C:\\temp\\old_sarif_files` = a directory of SARIF files with arbitrary filenames from an older build.\n- `C:\\code\\my_source_repo` = checkout directory of source code files from which SARIF results were obtained.\n\n### blame\n```\nusage: sarif blame [-h] [--output PATH] [--code PATH] [file_or_dir [file_or_dir ...]]\n\nEnhance SARIF file with information from `git blame`\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output PATH, -o PATH\n                        Output file or directory\n  --code PATH, -c PATH  Path to git repository; if not specified, the current working directory is used\n```\n\nAugment SARIF files with `git blame` information, and write the augmented files to a specified location.\n```shell\nsarif blame -o "C:\\temp\\sarif_files_with_blame_info" -c "C:\\code\\my_source_repo" "C:\\temp\\sarif_files"\n```\n\nIf the current working directory is the git repository, the `-c` argument can be omitted.\n\nSee [Blame filtering](blame-filtering) below for the format of the blame information that gets added to the SARIF files.\n\n### copy\n\n```\nusage: sarif copy [-h] [--output FILE] [--blame-filter FILE] [--timestamp] [file_or_dir [file_or_dir ...]]\n\nWrite a new SARIF file containing optionally-filtered data from other SARIF file(s)\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n  --blame-filter FILE, -b FILE\n                        Specify the blame filter file to apply. See README for format.\n  --timestamp, -t       Append current timestamp to output filename in the "yyyymmddThhmmssZ" format used by the `sarif trend` command\n```\n\nWrite a new SARIF file containing optionally-filtered data from an existing SARIF file or multiple\nSARIF files.  The resulting file contains each run from the original SARIF files back-to-back.\nThe results can be filtered (see [Blame filtering](blame-filtering) below), in which case only\nthose results from the original SARIF files that meet the filter are included; the output file\ncontains no information about the excluded records.  If a run in the original file was empty,\nor all its results are filtered out, the empty run is still included.\n\nIf no output filename is provided, a file called `out.sarif` in the current directory is written.\nIf the output file already exists and is also in the input file list, it is not included in the\ninputs, to avoid duplication of results.  The output file is overwritten without warning.\n\nThe `file_or_dir` specifier can include wildcards e.g. `c:\\temp\\**\\devskim*.sarif` (i.e.\na "glob").  This works for all commands, but it is particularly useful for `copy`.\n\nOne use for this is to combine a set of SARIF files from multiple static analysis tools run during\na build process into a single file that can be more easily stored and processed as a build asset.\n\n### csv\n\n```\nusage: sarif csv [-h] [--output PATH] [--blame-filter FILE] [--autotrim] [--trim PREFIX] [file_or_dir [file_or_dir ...]]\n\nWrite a CSV file listing the issues from the SARIF files(s) specified\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output PATH, -o PATH\n                        Output file or directory\n  --blame-filter FILE, -b FILE\n                        Specify the blame filter file to apply. See README for format.\n  --autotrim, -a        Strip off the common prefix of paths in the CSV output\n  --trim PREFIX         Prefix to strip from issue paths, e.g. the checkout directory on the build agent\n```\n\nWrite out a simple tabular list of issues from [a set of] SARIF files.  This can then be analysed, e.g. via Pivot Tables in Excel.\n\nUse the `--trim` option to strip specific prefixes from the paths, to make the CSV less verbose.  Alternatively, use `--autotrim` to strip off the longest common prefix.\n\nGenerate a CSV summary of a single SARIF file with common file path prefix suppressed:\n```shell\nsarif csv "C:\\temp\\sarif_files\\devskim_myapp.sarif"\n```\n\nGenerate a CSV summary of a directory of SARIF files with path prefix `C:\\code\\my_source_repo` suppressed:\n```shell\nsarif csv --trim c:\\code\\my_source_repo "C:\\temp\\sarif_files"\n```\n\nSee [Blame filtering](blame-filtering) below for how to use the `--blame-filter` option.\n\n### diff\n\n```\nusage: sarif diff [-h] [--output FILE] [--blame-filter FILE] old_file_or_dir new_file_or_dir\n\nFind the difference between two [sets of] SARIF files\n\npositional arguments:\n  old_file_or_dir       An old SARIF file or a directory containing the old SARIF files\n  new_file_or_dir       A new SARIF file or a directory containing the new SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n  --blame-filter FILE, -b FILE\n                        Specify the blame filter file to apply. See README for format.\n```\n\nPrint the difference between two [sets of] SARIF files.\n\nDifference between the issues in two SARIF files:\n```shell\nsarif diff "C:\\temp\\old_sarif_files\\devskim_myapp.sarif" "C:\\temp\\sarif_files\\devskim_myapp.sarif"\n```\n\nDifference between the issues in two directories of SARIF files:\n```shell\nsarif diff "C:\\temp\\old_sarif_files" "C:\\temp\\sarif_files"\n```\n\nWrite output to JSON file instead of printing to stdout:\n\n```shell\nsarif diff -o mydiff.json "C:\\temp\\old_sarif_files\\devskim_myapp.sarif" "C:\\temp\\sarif_files\\devskim_myapp.sarif"\n```\n\nSee [Blame filtering](blame-filtering) below for how to use the `--blame-filter` option.\n\n### html\n\n```\nusage: sarif html [-h] [--output PATH] [--blame-filter FILE] [--no-autotrim] [--image IMAGE] [--trim PREFIX] [file_or_dir [file_or_dir ...]]\n\nWrite an HTML representation of SARIF file(s) for viewing in a web browser\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output PATH, -o PATH\n                        Output file or directory\n  --blame-filter FILE, -b FILE\n                        Specify the blame filter file to apply. See README for format.\n  --no-autotrim, -n     Do not strip off the common prefix of paths in the output document\n  --image IMAGE         Image to include at top of file - SARIF logo by default\n  --trim PREFIX         Prefix to strip from issue paths, e.g. the checkout directory on the build agent\n```\n\nCreate an HTML file summarising SARIF results.\n\n```shell\nsarif html -o summary.html "C:\\temp\\sarif_files"\n```\n\nUse the `--trim` option to strip specific prefixes from the paths, to make the generated HTML page less verbose.  The longest common prefix of the paths will be trimmed unless `--no-autotrim` is specified.\n\nUse the `--image` option to provide a header image for the top of the HTML page.  The image is embedded into the HTML, so the HTML document remains a portable standalone file.\n\nSee [Blame filtering](blame-filtering) below for how to use the `--blame-filter` option.\n\n### info\n\n```\nusage: sarif info [-h] [--output FILE] [file_or_dir [file_or_dir ...]]\n\nPrint information about SARIF file(s) structure\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n```\n\nPrint information about the structure of a SARIF file or multiple files.  This is about the JSON\nstructure rather than any meaning of the results produced by the tool.  The summary includes the\nfull path of the file, its size and modified date, the number of runs, and for each run, the\ntool that generated the run, the number of results, and the entries in the results\' property bags.\n\n```\nc:\\temp\\sarif_files\\ios_devskim_output.sarif\n  1256241 bytes (1.2 MiB)\n  modified: 2021-10-13 21:50:01.251544, accessed: 2022-01-09 18:23:00.060573, ctime: 2021-10-13 20:49:00\n  1 run\n    Tool: devskim\n    1323 results\n    All results have properties: tags, DevSkimSeverity\n```\n\n### ls\n\n```\nusage: sarif ls [-h] [--output FILE] [file_or_dir [file_or_dir ...]]\n\nList all SARIF files in the directories specified\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n```\n\nList SARIF files in one or more directories.\n\n```shell\nsarif ls "C:\\temp\\sarif_files" "C:\\temp\\sarif_with_date"\n```\n\n### summary\n\n```\nusage: sarif ls [-h] [--output FILE] [file_or_dir [file_or_dir ...]]\n\nList all SARIF files in the directories specified\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n```\n\nPrint a summary of the issues in one or more SARIF file(s), grouped by severity and then ordered by number of occurrences.\n\nWhen directories are provided as input and output, a summary is written for each input file, along with another file containing the totals.\n\n```shell\nsarif summary -o summaries "C:\\temp\\sarif_files"\n```\n\nWhen no output directory or file is specified, the overall summary is printed to the standard output.\n\n```shell\nsarif summary "C:\\temp\\sarif_files\\devskim_myapp.sarif"\n```\n\nSee [Blame filtering](blame-filtering) below for how to use the `--blame-filter` option.\n\n### trend\n\n```\nusage: sarif trend [-h] [--output FILE] [--blame-filter FILE] [--dateformat {dmy,mdy,ymd}] [file_or_dir [file_or_dir ...]]\n\nWrite a CSV file with time series data from SARIF files with "yyyymmddThhmmssZ" timestamps in their filenames\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n  --blame-filter FILE, -b FILE\n                        Specify the blame filter file to apply. See README for format.\n  --dateformat {dmy,mdy,ymd}, -f {dmy,mdy,ymd}\n                        Date component order to use in output CSV. Default is `dmy`\n```\n\nGenerate a CSV showing a timeline of issues from a set of SARIF files in a directory.  The SARIF file names must contain a\ntimestamp in the specific format `yyyymmddThhhmmss` e.g. `20211012T110000Z`.\n\nThe CSV can be loaded in Microsoft Excel for graphing and trend analysis.\n\n```shell\nsarif trend -o timeline.csv "C:\\temp\\sarif_with_date" --dateformat dmy\n```\n\nSee [Blame filtering](blame-filtering) below for how to use the `--blame-filter` option.\n\n### usage\n\n```\nusage: sarif usage [-h] [--output FILE]\n\n(Command optional) - print usage and exit\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output FILE, -o FILE\n                        Output file\n```\n\nPrint usage and exit.\n\n### word\n\n```\nusage: sarif word [-h] [--output PATH] [--blame-filter FILE] [--no-autotrim] [--image IMAGE] [--trim PREFIX] [file_or_dir [file_or_dir ...]]\n\nProduce MS Word .docx summaries of the SARIF files specified\n\npositional arguments:\n  file_or_dir           A SARIF file or a directory containing SARIF files\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --output PATH, -o PATH\n                        Output file or directory\n  --blame-filter FILE, -b FILE\n                        Specify the blame filter file to apply. See README for format.\n  --no-autotrim, -n     Do not strip off the common prefix of paths in the output document\n  --image IMAGE         Image to include at top of file - SARIF logo by default\n  --trim PREFIX         Prefix to strip from issue paths, e.g. the checkout directory on the build agent\n```\n\nCreate Word documents representing a SARIF file or multiple SARIF files.\n\nIf directories are provided for the `-o` option and the input, then a Word document is produced for each individual SARIF file\nand for the full set of SARIF files.  Otherwise, a single Word document is created.\n\nCreate a Word document for each SARIF file and one for all of them together, in the `reports` directory (created if non-existent):\n```shell\nsarif word -o reports "C:\\temp\\sarif_files"\n```\n\nCreate a Word document for a single SARIF file:\n```shell\nsarif word -o "reports\\devskim_myapp.docx" "C:\\temp\\sarif_files\\devskim_myapp.sarif"\n```\n\nUse the `--trim` option to strip specific prefixes from the paths, to make the generated documents less verbose.  The longest common prefix of the paths will be trimmed unless `--no-autotrim` is specified.\n\nUse the `--image` option to provide a header image for the top of the Word document.\n\nSee [Blame filtering](blame-filtering) below for how to use the `--blame-filter` option.\n\n# Blame filtering\n\nUse the `sarif blame` command to augment a SARIF file or multiple SARIF files with blame information.\n\nBlame information is added to the property bag of each `result` object for which it was successfully obtained.  The keys and values used are as in the [git blame porcelain format](https://git-scm.com/docs/git-blame#_the_porcelain_format).  E.g.:\n\n```json\n{\n  "ruleId": "SM00702",\n  ...\n  "properties": {\n    "blame": {\n      "author": "aperson",\n      "author-mail": "<aperson@acompany.com>",\n      "author-time": "1350899798",\n      "author-tz": "+0000",\n      "committer": "aperson",\n      "committer-mail": "<aperson@acompany.com>",\n      "committer-time": "1350899798",\n      "committer-tz": "+0000",\n      "summary": "blah blah commit comment blah",\n      "boundary": true,\n      "filename": "src/net/myproject/mypackage/MyClass.java"\n    }\n  }\n}\n```\nNote that the bare `boundary` key is given the automatic value `true`.\n\nThis blame data can then be used for filtering and summarising via the `--blame-filter` option available for various commands.  This option requires a path to a filter-list file, containing a list of patterns and substrings to match against the blame information author email.  The format of a filter-list file is as follows:\n\n```\n# Lines beginning with # are interpreted as comments and ignored.\n# A line beginning with "description: " is interpreted as an optional description for the filter.  If no title is specified, the filter file name is used.\ndescription: Example filter from README.md\n# Lines beginning with "+: " are interpreted as inclusion substrings.  E.g. the following line includes issues whose author-mail field contains "@microsoft.com".\n+: @microsoft.com\n# The "+: " can be omitted.\n@microsoft.com\n# Instead of a substring, a regular expression can be used, enclosed in "/" characters.  Issues whose author-mail field includes a string matching the regular expression are included.  Use ^ and $ to match the whole author-mail field.\n+: /^<myname.*\\.com>$/\n# Again, the "+: " can be omitted for a regular expression include pattern.\n/^<myname.*\\.com>$/\n# Lines beginning with "-: " are interpreted as exclusion substrings.  E.g. the following line excludes issues whose author-mail field contains "bot@microsoft.com".\n-: bot@microsoft.com\n# Instead of a substring, a regular expression can be used, enclosed in "/" characters.  Issues whose author-mail field includes a string matching the regular expression are excluded.  Use ^ and $ to match the whole author-mail field.  E.g. the following pattern excludes all issues whose author-mail field contains a GUID.\n-: /[0-9A-F]{8}[-][0-9A-F]{4}[-][0-9A-F]{4}[-][0-9A-F]{4}[-][0-9A-F]{12}/\n```\n\nHere\'s an example of a filter-file that includes issues on lines changed by an `@microsoft.com` email address or a `myname.SOMETHING.com` email address, but not if those email addresses end in `bot@microsoft.com` or contain a GUID.  It\'s the same as the above example, with comments stripped out.\n\n```\ndescription: Example filter from README.md\n+: @microsoft.com\n+: /^<myname.*\\.com>$/\n-: bot@microsoft.com\n-: /[0-9A-F]{8}[-][0-9A-F]{4}[-][0-9A-F]{4}[-][0-9A-F]{4}[-][0-9A-F]{12}/\n```\n\nAll matching is case insensitive, because email addresses are.  Whitespace at the start and end of lines is ignored, which also means that line ending characters don\'t matter.  The blame filter file must be UTF-8 encoded (including plain ASCII7).  It can have a byte order mark or not.\n\nIf there are no inclusion patterns, all issues are included except for those matching the exclusion patterns.  If there are inclusion patterns, only issues matching the inclusion patterns are included.  If an issue matches one or more inclusion patterns and also at least one exclusion pattern, it is excluded.\n\nSometimes, there may be issues in the SARIF file to which the filter cannot be applied, because blame information is not available.  This can be for two reasons: either there is no blame information recorded for the file in which the issue occurred, or the issue location lacks a line number (or specifies line number 1 as a placeholder) so that blame information cannot be correlated to the issue.  These issues are included by default.  To identify which issues these are, create a filter file that excludes everything to which the filter can be applied:\n\n```\ndescription: Exclude everything filterable\n-: /.*/\n```\n\nThen run a `sarif` command using this filter file as the `--blame-filter` to see the default-included issues.\n\n# Usage as a Python library\n\nAlthough not its primary purpose, you can use sarif-tools from a Python script or module to\nload and summarise SARIF results.\n\n## Basic usage pattern\n\nAfter installation, use `sarif.loader` to load a SARIF file or files, and then use the operations\non the returned `SarifFile` or `SarifFileSet` objects to explore the data.\n\n```python\nfrom sarif import loader\n\nsarif_data = loader.load_sarif_file(path_to_sarif_file)\nissue_count_by_severity = sarif_data.get_result_count_by_severity()\nerror_histogram = sarif_data.get_issue_code_histogram("error")\n```\n\n## Result access API\n\nThe three classes defined in the `sarif_files` module, `SarifFileSet`, `SarifFile` and `SarifRun`,\nprovide similar APIs, which allows SARIF results to be handled similarly at multiple levels of\naggregation.  This section briefly describes some of the key APIs at the three levels of\naggregation.\n\n### get_distinct_tool_names()\n\nReturns a list of distinct tool names in a `SarifFile` or for all files in a `SarifFileSet`.\nA `SarifRun` has a single tool name so the equivalent method is `get_tool_name()`.\n\n### get_results()\n\nReturn the list of SARIF results.  These are objects as defined in the\n[SARIF standard section 3.27](https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317638).\n\n### get_records()\n\nReturn the list of SARIF results as simplified, flattened record dicts.  Each record has the\nattributes defined in `sarif_file.RECORD_ATTRIBUTES`.\n\n- `"Tool"` - the tool name for the run containing the result.\n- `"Severity"` - the SARIF severity for the record.  One of `error`, `warning` (the default if the\n  record doesn\'t specify) or `note`.\n- `"Code"` - the issue code from the result.\n- `"Location"` - the location of the issue, typically the file containing the issue.  Format varies\n  by tool.\n- `"Line"` - the line number in the file where the issue occurs.  Value is a string.  This defaults\n  to `"1"` if the tool failed to identify the line.\n\n### get_records_grouped_by_severity()\n\nAs per `get_records()`, but the result is a dict from SARIF severity level (`error`, `warning` and\n`note`) to the list of records of that severity level.\n\n### get_result_count(), get_result_count_by_severity()\n\nGet the total number of SARIF results.  `get_result_count_by_severity()` returns a dict from\nSARIF severity level (`error`, `warning` and `note`) to the integer number of results of that\nseverity.\n\n### get_issue_code_histogram(severity)\n\nFor the given severity, get histogram in the form of a list of pairs.  The first item in each pair\nis the issue code, the second item is the number of matching records, and the list is sorted in\ndecreasing order of frequency (the same as the `sarif summary` command output).\n\n### Disaggregation and filename access\n\nThese fields and methods allow access to the underlying information about the SARIF files.\n\n- `SarifFileSet.subdirs` - a list of `SarifFileSet` objects corresponding to the subdirectories of\n  the directory from which the `SarifFileSet` was created.\n- `SarifFileSet.files` - a list of `SarifFile` objects corresponding to the SARIF files contained\n  in the directory from which the `SarifFileSet` was created.\n- `SarifFile.get_abs_file_path()` - get the absolute path to the SARIF file.\n- `SarifFile.get_file_name()` - get the name of the SARIF file.\n- `SarifFile.get_file_name_without_extension()` - get the name of the SARIF file without its\n  extension.  Useful for constructing derived filenames.\n- `SarifFile.get_filename_timestamp()` - extract the timestamp from the filename of a SARIF file,\n  and return it as a string.  The timestamp must be in the format specified in the `sarif trend`\n  command.\n- `SarifFile.runs` - a list of `SarifRun` objects contained in the SARIF file.  Most SARIF files\n  only contain a single run, but it is possible to aggregate runs from multiple tools into a\n  single SARIF file.\n\n### Path shortening API\n\nCall `init_path_prefix_stripping(autotrim, path_prefixes)` on a `SarifFileSet`, `SarifFile` or `SarifRun` object to set up path filtering, either automatically removing the longest common prefix (`autotrim=True`) or removing specific prefixes (`autotrim=False` and a list of strings in `path_prefixes`).\n\n### Blame filtering API\n\nCall `init_blame_filter(filter_description, include_substrings, include_regexes, exclude_substrings, exclude_regexes)` on a `SarifFileSet`, `SarifFile` or `SarifRun` object to set up blame filtering.  `filter_description` is a string and the other parameters are lists of strings (with no `/` characters around the regular expressions).  They correspond in an obvious way to the filter file contents described in [Blame filtering](blame-filtering) above.\n\nCall `get_filter_stats()` to retrieve the filter stats after reading the results or records from sarif files.  It returns `None` if there is no filter, or otherwise a `sarif_file.FilterStats` object with integer fields `filtered_in_result_count`, `filtered_out_result_count`, `missing_blame_count` and `unconvincing_line_number_count`.  Call `to_string()` on the `FilterStats` object for a readable representation of these statistics, which also includes the filter file name or description (`filter_description` field).\n\n# Suggested usage in CI pipelines\n\nUsing the `--check` option in combination with the `summary` command causes sarif-tools to exit\nwith a nonzero exit code if there are any issues of the specified level, or higher.  This can\nbe useful to fail a continuous integration (CI) pipeline in the case of SAST violation.\n\nThe SARIF issue levels are `error`, `warning` and `note`.  These are all valid options for the\n`--check` option.\n\nE.g. to fail if there are any errors or warnings:\n\n```\nsarif --check warning summary c:\\temp\\sarif_files\n```\n\nThe `diff` command can check for any increase in issues of the specified level or above, relative\nto a previous or baseline build.\n\nE.g. to fail if there are any new issue codes at error level:\n\n```\nsarif --check error diff c:\\temp\\old_sarif_files c:\\temp\\sarif_files\n```\n\nYou can also use sarif-tools to filter and consolidate the output from multiple tools.  E.g.\n```\n# First run your static analysis tools, configured to write SARIF output.  How to do that depends\n# the tool.\n\n# Now run the blame command to augment the output with blame information.\nsarif blame -o with_blame/myapp_mytool_with_blame.sarif myapp_mytool.sarif\n\n# Now combine all tools\' output into a single file\nsarif copy --timestamp -o artifacts/myapp_alltools_with_blame.sarif\n```\n\nDownload the file `myapp_alltools_with_blame_TIMESTAMP.sarif` that is generated.  Then later you can\nfilter the results using the `--blame-filter` argument, or generate graph of code quality over time\nusing `sarif trend`.\n\n# Credits\n\nsarif-tools was originally developed during the Microsoft Global Hackathon 2021 by Simon Abykov, Nick Brabbs, Anthony Hayward, Sivaji Kondapalli, Matt Parkes and Kathryn Pentland.\n',
    'author': 'Microsoft',
    'author_email': None,
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/microsoft/sarif-tools',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
