Skip to content

Commit

Permalink
- README improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
miroslavpojer committed Jun 20, 2024
1 parent 611ae23 commit a45be8c
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ This action scans the specified `paths` for project files and checks if their fi
- **Description**: Specifies the format of the output report. Options include console, csv, and json.
- **Required**: No
- **Default**: `console`
- **Options**:
- `console`: Prints the report to the console as a warning log message.
- `csv`: Generates a CSV file with the report. No output prints to the console. Path to the report file is provided in the `report-path` output.
- `json`: Generates a JSON file with the report. No output prints to the console. Path to the report file is provided in the `report-path` output.

### `verbose-logging`
- **Description**: Enable verbose logging to provide detailed output during the action’s execution, aiding in troubleshooting and setup.
Expand All @@ -56,7 +60,7 @@ This action scans the specified `paths` for project files and checks if their fi
- **Description**: Count of files not complying with the specified file name patterns.

### `report-path`
- **Description**: Path to the generated report file.
- **Description**: Path to the generated report file. **Not used** if the `report-format` is set to `console`.

## Usage Example
### Default
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ outputs:
description: 'Count of files that do not comply with the specified file name conventions.'
value: ${{ steps.scan-test-files.outputs.violation_count }}
report-path:
description: 'Path to the generated report file.'
description: "Path to the generated report file. Not used when 'console' is selected as the report format."
value: ${{ steps.scan-test-files.outputs.report_path }}
runs:
using: 'composite'
Expand Down
21 changes: 18 additions & 3 deletions src/filename_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ def run():

set_output('violation-count', str(violation_count))

if report_format == 'console' or verbose_logging:
logging.warning(f'Total violations: {violation_count}')
logging.warning(f'Violating files: {violations}')
if verbose_logging:
print(f'Total violations: {violation_count}')
print(f'Violating files: {violations}')

if report_format == 'console':
logging.info(f'Total violations: {violation_count}')
logging.info(f'Violating files: {violations}')

if report_format == 'csv':
with open('violations.csv', mode='w', newline='') as file:
Expand All @@ -92,6 +96,17 @@ def run():
logging.error(f'Action failed with error: {error}')
set_failed(f'Action failed with error: {error}')

# TODO
# Inspector
# - report-path - ma ukazovat na spravny soubor a jeho cestu

# RLS notes generator
# - set_output na set_action_output
# - set_failed na set_action_failed
# -
# -
# -


if __name__ == '__main__':
run()

0 comments on commit a45be8c

Please sign in to comment.