CORTEXA
← Browse
openalexFigshare2026-07-23Cited by 0

LoggingSmellsMLCode

Foalem Patrick loic

AntiPatternLoggingMLA toolkit to collect, extract, and analyze logging usage and logging-related code snippets from GitHub repositories — focused on finding logging anti-patterns in machine learning code.The repository provides a CLI (implemented in <code>main.py</code>) with commands to:collect repository metadata (archived/accessibility) from CSV lists of reposmerge collected metadata filesclone repositoriesconvert Jupyter notebooks to Pythonextract Python files that contain logging/library callsclean leading comments before import statementsbuild a JSON dataset of logging snippetsanalyze and summarize logging datasetssample unique functions and snippets by library and log levelrun an LLM-based logging smell analysisThis README explains setup, usage examples for each CLI command, and tips for working with the pipeline.RequirementsPython 3.10 or newerRecommended: create and activate a virtual environmentInstall core dependencies (approximate list used by the project):<pre>python -m venv .venv; .\.venv\Scripts\Activate.ps1<br>pip install --upgrade pip<br>pip install pandas gitpython nbconvert nbformat openpyxl</pre>If you prefer, create a <code>requirements.txt</code> with these packages and install using <code>pip install -r requirements.txt</code>.Note: the project uses <code>pandas</code> to read/write CSV/Excel files and <code>GitPython</code> (<code>git</code>) to clone repositories.Project layout<code>main.py</code> - CLI entrypoint. Implements multiple subcommands (see Usage).<code>data/</code> - default data folder (configured in <code>config/constant.py</code>).<code>data_collection/</code> - modules to collect repos, extract logging files, analyze datasets, and sample snippets.<code>util/</code> - logging and utility helpers.<code>logs/</code> - default log file location (<code>logs/app.log</code>).Open <code>config/constant.py</code> if you want to change the default paths.Quick usageRun a CLI command like this (PowerShell examples):<pre># show help for the CLI<br>python main.py -h<br><br># show help for a specific command<br>python main.py collect -h</pre>All commands accept options; each command has sensible defaults defined in <code>main.py</code> (many default to paths inside <code>data/</code> and <code>logs/app.log</code>).Common commands and examplesCollect GitHub repository metadata<pre>python main.py collect --data_folder data --log_file logs/app.log</pre>This will find <code>*.csv</code> files inside <code>data/</code>, read repository names, query GitHub (via <code>data_collection.get_repo_infos</code>) to collect <code>accessible</code> and <code>archived</code> info, and write per-file outputs suffixed with <code>_with_archived.csv</code>.Merge archived results<pre>python main.py merge_archived --data_folder data --output_file merged_archived_dataset.csv</pre>Concatenates all <code>*_with_archived.csv</code> files, removes duplicates, and writes a merged CSV.Clone repositories from merged CSV<pre>python main.py clone_repos --input_file data\merged_archived_dataset.csv --output_dir data\cloned_repos</pre>Only clones repositories listed in the CSV. If the CSV contains <code>accessible</code> or <code>archived</code> columns, the CLI filters to <code>accessible == True</code> and <code>archived == False</code>.Convert notebooks to Python files<pre>python main.py convert_notebooks --root_dir data\cloned_repos</pre>Searches <code>root_dir</code> for <code>.ipynb</code> files and produces <code>.py</code> exports alongside them.Extract Python files with logging/library calls<pre>python main.py extract_logging_files --root_dir data\cloned_repos --output_dir data\logging_files</pre>Uses AST helpers to identify files with library/logging calls and copies them (preserving repo-relative structure) into <code>data/logging_files</code>.Remove header comments before imports<pre>python main.py clean_comments --root_dir data\logging_files</pre>Removes comment lines that occur before the first import statement in each <code>.py</code> file — useful to reduce noise before parsing.Create a JSON dataset of logging snippets<pre>python main.py create_logging_json_dataset --root_dir data\logging_files --output_file data\logging_dataset.json</pre>Walks <code>root_dir</code>, extracts logging-related functions/snippets via <code>data_collection.ast_helpers.extract_all_logging_files</code> and writes a structured JSON dataset.Analyze the logging dataset (write metrics to CSV)<pre>python main.py analyze_logging_dataset --json_path data\logging_dataset.json --csv_path data\logging_dataset_metrics.csv</pre>Filter the logging dataset (keep only relevant fields/functions)<pre>python main.py filter_logging_dataset --input_json data\logging_dataset.json --output_json data\logging_dataset_filtered_function.json</pre>Summarize the filtered dataset<pre>python main.py summarize_logging_dataset --json_path data\logging_dataset_filtered_function.json --csv_path data\logging_dataset_summary.csv</pre>Summarize unique functions per logging library and log level<pre>python main.py summarize_unique_functions --json_path data\logging_dataset_filtered_function.json --csv_path data\logging_dataset_unique_functions.csv</pre>Sample snippets by library and level<pre>python main.py sample_snippets --input_csv data\logging_dataset_unique_functions.csv --output_csv data\logging_dataset_sampled_snippets.csv</pre>Run LLM logging smell analysis (uses module <code>data_collection.llm_logging_smell_analysis</code>)<pre>python main.py llm_logging_smell_analysis</pre>This command currently delegates to the <code>cli_llm_logging_smell_analysis</code> function; check <code>data_collection/llm_logging_smell_analysis.py</code> for configuration and model usage details.Configuration &amp; pathsDefaults for data and other paths are defined in <code>config/constant.py</code>. If you want to change where data or logs are stored, update that file or pass explicit CLI arguments to the commands.Logging output (both console and file) is managed with <code>util.log.setup_logging</code>; logs are written to <code>logs/app.log</code> by default.TroubleshootingCloning failures: public repositories should clone via HTTPS. If some repos require credentials, configure Git authentication (SSH keys or a credential helper / PAT) and/or modify the <code>clone_repos</code> implementation to include credentials.GitHub API rate limits: the <code>collect</code> command may query GitHub and could hit rate limits. Consider using authentication or run the collection in batches.Missing packages: install the packages listed in the Requirements section.Large datasets: some operations iterate over many repos/files — run them on a subset first to validate the pipeline.Development &amp; ContributionCode is organized under <code>data_collection/</code> (domain logic) and <code>util/</code> (helpers).Add small unit tests for core helpers (AST helpers, dataset filters) and run them before submitting PRs.If you'd like, I can also:add a <code>requirements.txt</code> or <code>pyproject.toml</code> for reproducible installsadd example small datasets and a quick smoke-test scriptadd more detailed docs for <code>data_collection/llm_logging_smell_analysis</code>License &amp; contactThis repository does not include a license file; add an appropriate <code>LICENSE</code> file if you plan to share the project.For questions or help, open an issue or contact the maintainer.

View free PDFSource page

Related papers

openalexFigshare2026-07-26

Raw Data

Alee Marschke

Repository storing all data used for the paper: "Taking a Swing at Uncertainty: A Neural Network Analysis of Major League Baseball Strikeout Rates"These data were derived from the following resources available in the public domain: FanGraphs

View free PDFSource page
openalexFigshare2026-07-26

Algorithmic Detection of Chronological Sleep Decay: An L2-Regularized Logistic Regression Analysis of CDC Surveillance Data (1991–2023)

Akhtar Ms

Background &amp; Objective: Chronic sleep deprivation among adolescents has accelerated over the past three decades, aligning with widespread digital media saturation and reported cognitive focus issues. Traditional public health tracking often evaluates short‑term trends, overlo…

View free PDFSource page
openalexFigshare2026-07-26

A Leaf Area Index dataset retrieved by benchmark-driven machine learning framework from Chinese Fengyun-3B VIRR data

Jiakai You, Yinghui Zhang, Yonghong Liu, Zhongwen Hu, Jingzhe Wang, G H Wu

Leaf Area Index (LAI) serves as a key biophysical parameter for characterizing vegetation canopy structure and ecosystem functions. To address the absence of LAI products for the Fengyun-3B (FY-3B) satellite and the limitations of current satellite LAI products, this study propos…

View free PDFSource page
openalexFigshare2026-07-26

Dataset and Multi-View Evaluation Logs for Risk-Conscious Perception and Dynamic Threshold Optimization in AI-Based ADAS

ROHIT JOSHI

This project introduces a <b>risk-conscious perception and decision framework</b> for Advanced Driver Assistance Systems (ADAS). By combining multi-view camera inputs (rear, left, and right) with YOLO object detection, the system replaces traditional fixed confidence thresholds w…

View free PDFSource page