Skip to content

Commit

Permalink
Refactor codebase extensively; add input validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mohrez86 committed Oct 12, 2024
1 parent 8f917ea commit 8429833
Show file tree
Hide file tree
Showing 156 changed files with 6,974 additions and 5,057 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,5 @@ target/
make_env.sh

FauxPyReport*

.DS_Store
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# FauxPy Changelog

## Unreleased
## FauxPy 0.2.0
- Add entry for Analysis Mode.
- Refactor code structure.
- Add input validation for command-line arguments.
- Improve the Read the Docs
documentation.
- Update the README files in the
Expand All @@ -9,7 +12,6 @@ directory.
- Add `version.py` file to manage FauxPy's versioning.

## FauxPy 0.1.1

- Remove tests depending on FauxPy.
- Add Read the Docs documentation.
- Fix a bug in ST.
Expand Down
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ FauxPy's source code and
instructions to install
and use the tool.

*For comprehensive documentation, visit
[FauxPy
documentation](https://fauxpy.readthedocs.io/).*
- For comprehensive documentation, visit
[FauxPy documentation](https://fauxpy.readthedocs.io/).
- You can also participate in our
[Discussions section](https://github.com/mohrez86/fauxpy/discussions)
for questions, feedback, and more.
- If you encounter any issues, feel free
to open an issue on our
[GitHub repository](https://github.com/mohrez86/fauxpy/issues).

## Features

Expand Down
7 changes: 6 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# Configuration file for the Sphinx documentation builder.
import datetime
import os
import sys
from pathlib import Path

sys.path.insert(0, os.path.abspath("../../."))

# Load version
root_path = Path(__file__).parents[2]
version_file_path = root_path / "fauxpy" / 'version.py'
version_file_path = root_path / "fauxpy" / "version.py"
__version__ = ""
exec(version_file_path.read_text())
assert __version__ != ""
Expand All @@ -27,6 +31,7 @@
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
]

intersphinx_mapping = {
Expand Down
55 changes: 55 additions & 0 deletions docs/source/developer/entry_points.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
=========================
Entry Points and Handlers
=========================

FauxPy can work in two different modes: **Pytest Mode** and **Analysis Mode**.

- **Pytest Mode** is activated when FauxPy is used with commands like
``pytest tests --src my_code``. In this mode, FauxPy runs as a Pytest
plugin, integrating itself into the test execution pipeline to gather
information about the tests being run.

- **Analysis Mode** is activated when FauxPy is used with commands like
``fauxpy -v``. In this mode, FauxPy runs as a standalone application,
independently of Pytest.

Module ``main.py`` is the main entry point for FauxPy, determining
FauxPy's mode based on how FauxPy is executed.

Module ``main.py``
==================

This module is the main entry point for FauxPy, containing six functions.
The function ``fauxpy_analysis_mode`` is called when FauxPy starts in Analysis Mode.
It creates an instance of the ``FauxpyAnalysisModeHandler`` class, which manages
the whole Analysis Mode.

The other five functions in ``main.py`` are Pytest hooks executed in Pytest Mode.
Module ``main.py`` instantiates a ``FauxpyPytestModeHandler`` object as a global variable.
These hooks call corresponding methods in the object, delegating control
of Pytest Mode to class ``FauxpyPytestModeHandler``.

Below are the details of these six functions in ``main.py``.

.. automodule:: fauxpy.main
:members:

Pytest Mode Handler
===================

Class ``FauxpyPytestModeHandler`` is responsible for managing Pytest Mode.
Details of this class are provided below.

.. automodule:: fauxpy.command_line.pytest_mode.handler
:members:

Analysis Mode Handler
=====================

Class ``FauxpyAnalysisModeHandler`` manages Analysis Mode.
Details of this class are provided below. Currently, Analysis Mode
supports only one command, ``fauxpy --version``, which shows
the current version of FauxPy.

.. automodule:: fauxpy.command_line.analysis_mode.handler
:members:
6 changes: 6 additions & 0 deletions docs/source/developer/sbfl.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
===================================
Spectrum-Based Fault Localization
===================================

.. automodule:: fauxpy.fault_localization.sbfl.session_lib
:members:
42 changes: 23 additions & 19 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,18 @@ FauxPy documentation
.. image:: https://img.shields.io/github/stars/atom-sw/fauxpy?style=social
:target: https://github.com/atom-sw/fauxpy

.. image:: https://img.shields.io/github/stars/mohrez86/fauxpy?style=social
:target: https://github.com/mohrez86/fauxpy

FauxPy (pronounced: "foh pie") is an automated fault localization tool for Python programs,
`available as open-source software on GitHub <https://github.com/atom-sw/fauxpy>`_.
This documentation includes instructions to install and use FauxPy.

.. note::
We are improving FauxPy as we continue our
research, and we value your **feedback and suggestions**.
Whether it's regarding the user interface, new features,
or any other aspect of FauxPy,
your input can be incredibly helpful.
Please send your suggestions or feedback to us at:

**rezaalipour [dot] mohammad [at] gmail [dot] com**

If you enjoy using FauxPy and find it useful, giving us
a `star on GitHub <https://github.com/atom-sw/fauxpy>`_ would greatly encourage us
and make us happy. Your support means a lot to us!

.. image:: https://img.shields.io/github/stars/atom-sw/fauxpy?style=social
:target: https://github.com/atom-sw/fauxpy
.. tip::
We are constantly improving FauxPy and
welcome your **feedback and suggestions**.
Share your ideas in our
`Discussions section <https://github.com/mohrez86/fauxpy/discussions>`_.


Features
Expand Down Expand Up @@ -77,15 +69,27 @@ at
:target: https://www.youtube.com/watch?v=6ooPPiwd79g


Contents
========

.. toctree::
:maxdepth: 1
:caption: User Guide

user/installation
user/getting_started
user/using_fauxpy
user/limitations
user/test_repo
user/citing_fauxpy_and_references

.. toctree::
:maxdepth: 1
:caption: API Documentation

developer/entry_points
.. developer/sbfl
.. API Indices and tables
.. ======================
.. * :ref:`genindex`
.. * :ref:`modindex`
.. * :ref:`search`
11 changes: 5 additions & 6 deletions docs/source/user/test_repo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,11 @@ projects can be used for further research
in the software analysis domain.

If you discover any case where FauxPy
does not work
with a project, whether it's one
does not work with a project, whether it's one
of the included ones or a different
real-world project,
please let us know so that
real-world project, please let us know
via our
`Discussions section <https://github.com/mohrez86/fauxpy/discussions>`_
so that
we can fix bugs, improve FauxPy, and add
new projects to our test repository.

Email: **rezaalipour [dot] mohammad [at] gmail [dot] com**
30 changes: 5 additions & 25 deletions examples/triangle_area/README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,15 @@
# Triangle Area Example

This directory contains an
example project demonstrating
the use of FauxPy to perform
fault localization on a simple
Python program that
calculates the area
of a triangle.

## Getting Started
example project to demonstrate
the use of FauxPy.

To get started with this example,
please refer to the detailed
walkthrough available in the
FauxPy documentation on
Read the Docs:

[Read the Docs: FauxPy
Usage Example](https://fauxpy.readthedocs.io/en/latest/user/getting_started.html)
please refer to the
[Usage Example](https://fauxpy.readthedocs.io/en/latest/user/getting_started.html)
page on FauxPy documentation.

The documentation provides step-by-step
instructions on setting up the
environment, running the example, and
understanding the results.

## Additional Resources

- [FauxPy Repository](https://github.com/atom-sw/fauxpy)
- [FauxPy Documentation](https://fauxpy.readthedocs.io)

For any further assistance or
questions, feel free to open an
issue on our
[GitHub repository](https://github.com/atom-sw/fauxpy/issues).
11 changes: 0 additions & 11 deletions fauxpy/collect_mode/__init__.py

This file was deleted.

Loading

0 comments on commit 8429833

Please sign in to comment.