darth218/code-quality-assessment
0
To Do
- [x] Choose a programming language
- [X] Choose a model
- [X] Decide where to train and store data
- [x] Data scraping
- [x] Feature extraction
- [X] Data pre-processing
- [x] Model training
- [x] Model evaluation
- [ ] Report writing
- [ ] Deployment
Project Objective
- Collect code samples from public code repositories.
- Run static analysis to extract metrics.
- Detect code smells and annotate quality levels.
- Engineer features fro code structure and static metrics.
- Train ML model(s) for overall quality prediction.
- Evaluate model(s) performance and accuracy.
- Provide insights and improvement suggestions based on predictions.
Pipeline
scraper.py -> analyzer.py -> dataset_builder.py -> training -> evaluatingData Collection
Languages used
- Python
- Java
- C++
Sources
- Github
- ~Gitlab~
Scraping
scraper.pyqueries Github REST API to find repositories and stores metadata (URL, Lanaguage, etc...).metadata_collector.pyextracts repo metadata and stores it/data/metadata.json.downloader.pyclones repos (using git) and stores them as raw data using a list generated by the scraper/data/raw/temp/.file_extractor.pyextracts relevant source code files/data/raw/{repo_name}/{language}/{file_name}.
Feature Extraction
- Send code files through
analyzer.pythat acts like a dispatcher for selecting the correct analyzer. analyzer.pysends code to the correct analyzer, e.g.,python_analyzer.py.- Analyzer output is sent to
metrics_extractor.pyfor normalization and consistency. smell_detector.pyextracts and categorizes code smells.report_generator.pygenerates structured JSON/CSV for dataset entry using all the previous steps/data/processed/analysis_result/{repo_name}_{file_name}.json.
Feature Engineering
feature_builder.pybuilds complete feature sets (encoding, normalization, etc...) from the JSON data (outputs a CSV record).dataset_builder.pycreates the final dataset and saves it to/data/processed/dataset.csv
Model(s) Design
Tree-based models will be used for detecting code smells.
Target
- Code smells
- Overall code quality
