### Installing Ondivi via Pip (Bash) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Command to install the ondivi package using the Python package installer, pip. This is the standard method for obtaining the tool. ```bash pip install ondivi ``` -------------------------------- ### Example Flake8 Output (Bash) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Shows a sample output from running Flake8 on a file, listing multiple coding violations with their file, line number, column, error code, and message. This is the input format that ondivi processes. ```bash $ flake8 file.py file.py:3:1: E302 expected 2 blank lines, found 1 file.py:9:1: E302 expected 2 blank lines, found 1 file.py:10:121: E501 line too long (123 > 120 characters) file.py:14:1: E305 expected 2 blank lines after class or function definition, found 1 ``` -------------------------------- ### Example Ondivi Filtered Output (Bash) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Shows the final output after piping the Flake8 violations through ondivi. It demonstrates that only the violation on line 12 (which was added in the diff) is reported, effectively filtering out violations on unchanged lines. ```bash $ flake8 script.py | ondivi file.py:12:80: E501 line too long (119 > 79 characters) ``` -------------------------------- ### Example Git Diff Output (Diff) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Illustrates the changes in a file using the Git diff format. Lines prefixed with '+' indicate additions. This diff shows two new lines added at line 12 and line 16, which ondivi uses to identify changed code. ```diff from dataclasses import dataclass @dataclass class User(object): name: str age: int def greet(user: User): print('Long string in initial commit ################################################################################') print(f'Hello, {user.name}!') + print('Long string in new commit ################################################################################') if __name__ == '__main__': greet(User(345, 23)) + greet(User('Bob', '23')) ``` -------------------------------- ### Displaying Ondivi Command-Line Help (Bash) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Shows the output of the `ondivi --help` command, detailing the available options such as --baseline, --fromfile, --format, and --only-violations, along with their descriptions and default values. ```bash $ ondivi --help Usage: ondivi [OPTIONS] Ondivi (Only diff violations). Python script filtering coding violations, identified by static analysis, only for changed lines in a Git repo. Usage example: flake8 script.py | ondivi Options: --baseline TEXT Commit or branch which will contain legacy code. Program filter out violations on baseline (default: "master") --fromfile TEXT Path to file with violations. Expected "utf-8" encoding --format TEXT Template for parsing linter messages. The template should include the following named parts: {filename} The name of the file with the error/warning {line_num} The line number with the error/warning (integer) Example usage: --format "{filename}:{line_num:d}{other}" In this example, the linter message "src/app_types/listable.py:23:1: UP035 Import from collections.abc instead: Sequence" will be recognized and parsed into the following components: - filename: "src/app_types/listable.py" - line_num: 23 - other: :1: "UP035 Import from collections.abc instead: Sequence" Ensure that the template matches the format of the messages generated by your linter. (default: "{filename}:{line_num:d}{other}") --only-violations Show only violations --help Show this message and exit. ``` -------------------------------- ### Using Ondivi with Linters via File (Bash) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Shows an alternative usage where linter output is saved to a file first, and then ondivi is run with the --fromfile option to process the violations from the file. Useful for larger outputs or specific workflows. ```bash flake8 script.py > violations.txt ondivi --fromfile=violations.txt ``` -------------------------------- ### Using Ondivi with Linters via Pipe (Bash) Source: https://github.com/blablatdinov/ondivi/blob/master/README.md Demonstrates how to pipe the output of static analysis tools like Flake8 or Ruff directly into ondivi for filtering violations on changed lines. Requires the linter command to output violations in a format ondivi can parse. ```bash flake8 script.py | ondivi # with ruff: ruff check file.py --output-format=concise | ondivi ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.