Skip to content

Commit

Permalink
Merge pull request #5526 from wazuh/fix/5519-binary-plot
Browse files Browse the repository at this point in the history
Fix binary data plot
  • Loading branch information
juliamagan authored Jul 1, 2024
2 parents 48e94be + 29bd234 commit 08db0f4
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code_analysis.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Code analysis
on:
on: # yamllint disable-line rule:truthy comments
pull_request:
types:
- opened
Expand All @@ -13,8 +13,8 @@ jobs:
- name: Download files
uses: actions/checkout@v3

- name: Install pycodestyle and yamllint linter
run: python -m pip install pycodestyle==2.8.0 yamllint==1.26.3
- name: Install pycodestyle, flake8 and yamllint linter
run: python -m pip install pycodestyle==2.10.0 yamllint==1.26.3 flake8==6.0.0

- name: Get the updated files
id: updated_files
Expand Down
28 changes: 23 additions & 5 deletions .github/workflows/scripts/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,28 @@ def run_python_linter(python_files):
print('No python files were found. Skipping python linter analysis')
return 0

linters_data = {
'pycodestyle': {
'command': 'pycodestyle',
'parameters': ['--max-line-length=120']
},
'flake8': {
'command': 'flake8',
'parameters': ['--max-line-length=120']
}
}

linters_result = {}

# Set the linter parameters
parameters = ['pycodestyle', '--max-line-length=120']
parameters.extend(python_files)
for linter, linter_data in linters_data.items():
full_command = [linter_data['command']]
full_command.extend(linter_data['parameters'])
full_command.extend(python_files)

linters_result[linter] = subprocess.run(full_command).returncode

return subprocess.run(parameters).returncode
return linters_result


def run_yaml_linter(yaml_files, config_files_path):
Expand Down Expand Up @@ -175,13 +192,14 @@ def main():
yaml_files = get_yaml_files(updated_files)

# Run the python linter analysis process
python_linter_status = run_python_linter(python_files)
python_linter_results = run_python_linter(python_files)
python_linter_failed = any(status != 0 for linter, status in python_linter_results.items())

# Run the yaml linter analysis process
yaml_linter_status = run_yaml_linter(yaml_files, script_parameters.config_path)

# Return failure code if some check has not passed
if python_linter_status != 0 or yaml_linter_status != 0:
if python_linter_failed or yaml_linter_status != 0:
sys.exit(1)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def __init__(self, dataframes_paths, store_path=gettempdir(), base_name=None, un
base_name (str, optional): Base name for saved visualizations. Defaults to None.
unify_child_daemon_metrics (bool, optional): Whether to unify child daemon metrics. Defaults to False.
"""
super().__init__(dataframes, store_path, base_name)
super().__init__(dataframes_paths, store_path, base_name)
self._validate_dataframe()
if unify_child_daemon_metrics:
self.dataframe = self.dataframe.reset_index(drop=False)
Expand Down Expand Up @@ -341,7 +341,7 @@ def __init__(self, dataframes_paths, daemon, store_path=gettempdir(), base_name=
base_name (str, optional): Base name for saved visualizations. Defaults to None.
"""
self.daemon = daemon
super().__init__(dataframes, store_path, base_name)
super().__init__(dataframes_paths, store_path, base_name)
self.plots_data = self._load_plot_data()
self.expected_fields = []
for graph in self.plots_data.values():
Expand Down Expand Up @@ -414,7 +414,7 @@ def __init__(self, dataframes_paths, store_path=gettempdir(), base_name=None):
store_path (str, optional): Path to store visualizations. Defaults to system temp directory.
base_name (str, optional): Base name for saved visualizations. Defaults to None.
"""
super().__init__(dataframes, 'logcollector', store_path, base_name)
super().__init__(dataframes_paths, 'logcollector', store_path, base_name)

def _get_expected_fields(self):
"""Get the list of expected fields for logcollector statistics.
Expand Down

0 comments on commit 08db0f4

Please sign in to comment.