Platform for Machine Learning projects on Software Engineering
Перейти к файлу
Marco Castelluccio 3324f91f00 Keep using standard json library in the test scheduling history retrieval task
The orjson library doesn't support stream reading from a file, so here
the standard json library is preferable.
2019-10-18 01:25:31 +01:00
bugbug Don't fail when trying to remove a DB which does not exist 2019-10-16 16:19:11 +02:00
http_service Bump marshmallow from 3.2.0 to 3.2.1 (#994) 2019-10-01 10:54:52 +02:00
infra Bump taskcluster from 19.0.0 to 20.0.0 (#1020) 2019-10-16 14:47:04 +02:00
scripts Keep using standard json library in the test scheduling history retrieval task 2019-10-18 01:25:31 +01:00
tests Add a test for the removal of a non-existent DB 2019-10-16 16:20:53 +02:00
.dockerignore Update root dockerignore (#266) 2019-04-12 12:31:52 +02:00
.flake8 Remove useless comment 2019-06-11 17:28:45 +02:00
.gitignore Add more automatically generated files to .gitignore 2019-09-28 18:18:12 +02:00
.isort.cfg Use orjson in cases where we need high performance 2019-10-16 16:10:29 +02:00
.pre-commit-config.yaml Update pre-commit configuration 2019-09-13 11:04:53 +02:00
.taskcluster.yml Pin CI image to Python 3.7 2019-10-16 14:07:03 +02:00
CODE_OF_CONDUCT.md Remove trailing whitespaces from CODE_OF_CONDUCT.md 2019-05-14 17:31:02 +02:00
CONTRIBUTING.md Clarify unassigned issues rules 2019-07-12 11:54:51 +02:00
LICENSE First commit 2018-03-11 20:12:35 +00:00
MANIFEST.in Move Keras as an optional dependency (#319) 2019-04-26 18:50:02 +02:00
README.md Update README to explain how to run the training script 2019-09-05 10:47:04 +02:00
VERSION Version 0.0.128 2019-10-16 16:28:06 +02:00
docker-compose.yml Add a Dockerfile for tools using bugbug nlp stuff (#934) 2019-09-07 00:45:47 +02:00
extra-nlp-requirements.txt Bump spacy from 2.1.8 to 2.2.1 (#1001) 2019-10-03 19:58:33 +01:00
extra-nn-requirements.txt Use tf.keras and stop using keras 2019-10-05 21:54:26 +01:00
pytest.ini Add a mock DB for tests to avoid downloading the full DB (#273) 2019-04-18 14:01:25 +02:00
requirements.txt Bump rs-parsepatch from 0.2.3 to 0.2.4 (#1024) 2019-10-17 11:27:47 +02:00
setup.py Add a task to retrieve test scheduling history 2019-09-11 21:16:19 +02:00
test-requirements.txt Bump jsonschema from 3.0.2 to 3.1.1 (#1014) 2019-10-10 00:54:53 +01:00

README.md

bugbug

Task Status

Bugbug aims at leveraging machine learning techniques to help with bug and quality management, and other software engineering tasks.

More information on the Mozilla hacks blog: https://hacks.mozilla.org/2019/04/teaching-machines-to-triage-firefox-bugs/

Classifiers

  • assignee - The aim of this classifier is to suggest an appropriate assignee for a bug.

  • backout - The aim of this classifier is to detect patches that might be more likely to be backed-out (because of build or test failures). It could be used for test prioritization/scheduling purposes.

  • bugtype - The aim of this classifier is to classify bugs according to their type.

  • component - The aim of this classifier is to assign product/component to (untriaged) bugs.

  • defect vs enhancement vs task - Extension of the defect classifier to detect differences also between feature requests and development tasks.

  • defect - Bugs on Bugzilla aren't always bugs. Sometimes they are feature requests, refactorings, and so on. The aim of this classifier is to distinguish between bugs that are actually bugs and bugs that aren't. The dataset currently contains 2110 bugs, the accuracy of the current classifier is ~93% (precision ~95%, recall ~94%).

  • devdocneeded - The aim of this classifier is to detect bugs which should be documented for developers.

  • duplicate - The aim of this classifier is to detect duplicate bugs.

  • qaneeded - The aim of this classifier is to detect bugs that would need QA verification.

  • regression vs non-regression - Bugzilla has a regression keyword to identify bugs that are regressions. Unfortunately it isn't used consistently. The aim of this classifier is to detect bugs that are regressions.

  • regressionrange - The aim of this classifier is to detect regression bugs that have a regression range vs those that don't.

  • regressor - The aim of this classifier is to detect patches which are more likely to cause regressions. It could be used to make riskier patches undergo more scrutiny.

  • stepstoreproduce - The aim of this classifier is to detect bugs that have steps to reproduce vs those that don't.

  • tracking - The aim of this classifier is to detect bugs to track.

  • uplift - The aim of this classifier is to detect bugs for which uplift should be approved and bugs for which uplift should not be approved.

Setup

Run pip install -r requirements.txt and pip install -r test-requirements.txt. Depending on the parts of bugbug you want to run, you might need to install dependencies from other requirement files (find them with find . -name "*requirements*").

Currently, Python 3.7+ is required. You can double check the version we use by looking at setup.py.

Auto-formatting

This project is using pre-commit. Please run pre-commit install to install the git pre-commit hooks on your clone.

Every time you will try to commit, pre-commit will run checks on your files to make sure they follow our style standards and they aren't affected by some simple issues. If the checks fail, pre-commit won't let you commit.

Usage

Run the trainer.py script with the command python3 -m scripts.trainer (with --help to see the required and optional arguments of the command) to perform training.

Running the repository mining script

Note: This section is only necessary if you want to perform changes to the repository mining script. Otherwise, you can simply use the commits data we generate automatically.

  1. Clone https://hg.mozilla.org/mozilla-central/.
  2. Run ./mach vcs-setup in the directory where you have cloned mozilla-central.
  3. Enable the extensions mentioned in infra/hgrc. For example, if you are on Linux, you can add firefoxtree to the extensions section of the ~/.hgrc file as:
    firefoxtree = ~/.mozbuild/version-control-tools/hgext/firefoxtree
    
  4. Run the repository.py script, with the only argument being the path to the mozilla-central repository.

Note: If you run into problems, it's possible the version of Mercurial you are using is not supported. Check the Docker definition at infra/dockerfile.commit_retrieval to see what we are using in production.

Note: the script will take a long time to run (on my laptop more than 7 hours). If you want to test a simple change and you don't intend to actually mine the data, you can modify the repository.py script to limit the number of analyzed commits. Simply add limit=1024 to the call to the log command.

Structure of the project

  • bugbug/labels contains manually collected labels;
  • bugbug/db.py is an implementation of a really simple JSON database;
  • bugbug/bugzilla.py contains the functions to retrieve bugs from the Bugzilla tracking system;
  • bugbug/repository.py contains the functions to mine data from the mozilla-central (Firefox) repository;
  • bugbug/bug_features.py contains functions to extract features from bug/commit data;
  • bugbug/model.py contains the base class that all models derive from;
  • bugbug/models contains implementations of specific models;
  • bugbug/nn.py contains utility functions to include Keras models into a scikit-learn pipeline;
  • bugbug/utils.py contains misc utility functions;
  • bugbug/nlp contains utility functions for NLP;
  • bugbug/labels.py contains utility functions for handling labels;
  • bugbug/bug_snapshot.py contains a module to play back the history of a bug.