diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml
new file mode 100644
index 0000000..de21288
--- /dev/null
+++ b/.github/workflows/linting.yml
@@ -0,0 +1,26 @@
+name: Pylint
+
+on: [push, pull_request]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ python-version: ["3.8", "3.9", "3.10"]
+ steps:
+ - uses: actions/checkout@v3
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v3
+ with:
+ python-version: ${{ matrix.python-version }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pylint pycodestyle colorama
+ - name: Analysing the code with pylint
+ run: |
+ pylint $(git ls-files '*.py')
+ - name: Analysing the code with pycodestyle
+ run: |
+ pycodestyle $(git ls-files '*.py' | grep -v setup.py)
diff --git a/MANIFEST.in b/MANIFEST.in
index bb3ec5f..6745f6b 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1 +1,3 @@
include README.md
+recursive-exclude errors_logs *
+exclude pylintrc
\ No newline at end of file
diff --git a/README.md b/README.md
index 2cef76e..6eb03f6 100644
--- a/README.md
+++ b/README.md
@@ -56,7 +56,10 @@ If you'd like to contribute to Betty Fixer, please follow these steps:
-### Creaters: -
+### Creators: -
[@Moealsir](https://github.com/Moealsir)
[@Malazmuzamil98](https://github.com/malazmuzamil98)
-[@AhedEisa](https://github.com/be-great)
\ No newline at end of file
+[@AhedEisa](https://github.com/be-great)
+
+### Contributors:
+[@Younis-ahmed](https://github.com/Younis-ahmed)
diff --git a/bettyfixer/__init__.py b/bettyfixer/__init__.py
index 5ade3d7..121bbec 100644
--- a/bettyfixer/__init__.py
+++ b/bettyfixer/__init__.py
@@ -1 +1,6 @@
-from .betty_fixer import *
\ No newline at end of file
+"""
+This module provides the Betty Fixer functionality.
+"""
+
+from .betty_fixer import *
+# modify_main_files(sys.argv[1:])
diff --git a/bettyfixer/autoprototype.py b/bettyfixer/autoprototype.py
index 1888417..5671243 100644
--- a/bettyfixer/autoprototype.py
+++ b/bettyfixer/autoprototype.py
@@ -1,15 +1,24 @@
-import argparse
+"""
+This module contains the functions to generate a header file with
+the prototypes of the functions in a directory.
+"""
import subprocess
import os
-import re
-from colorama import Fore
import glob
+from colorama import Fore
+
-# betty cj
def betty_check():
+ """Check if betty is installed and if there are any errors in the files.
+ Returns:
+ bool: True if betty is installed and there are no errors,
+ False otherwise.
+ """
try:
c_files = glob.glob("*.c")
- result1 = subprocess.run(["betty"] + c_files, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
+ result1 = subprocess.run(["betty"] + c_files, check=True,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, text=True)
except subprocess.CalledProcessError as e:
print(e)
@@ -23,78 +32,152 @@ def betty_check():
return result1.returncode == 0
-## auto checks errors
def print_check_betty_first():
- print(Fore.RED + "You should fix betty Errors first before copy prototype functions into The header file" + Fore.RESET)
+ """Prints a message to the user to fix betty errors first."""
+ print(
+ Fore.RED + "You should fix betty Errors first before \
+copy prototype functions into The header file" + Fore.RESET
+ )
+
+
def print_header_name_missing():
+ """Prints a message to the user to provide a header file name."""
print(Fore.RED + "Usage : bettyfixer -H .h" + Fore.RESET)
-def print_Ctags_header_error(msg):
+
+
+def print_ctags_header_error(msg):
+ """Prints a message to the user in red color."""
print(Fore.RED + msg + Fore.RESET)
+
def check_ctags():
+ """Check if ctags is installed.
+ Returns:
+ bool: True if ctags is installed, False otherwise.
+ str: Error message if ctags is not installed.
+ """
try:
- subprocess.run(['ctags', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
+ subprocess.run(['ctags', '--version'], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, check=True)
return True, None
except subprocess.CalledProcessError:
- msg = "ctags is not installed. Please install ctags before running this script."
+ msg = "ctags is not installed. \
+Please install ctags before running this script."
return False, msg
+
def generate_tags(directory):
+ """Generate tags for the files in the directory.
+ Args:
+ directory (str): Directory path.
+ Returns:
+ bool: True if ctags is generated successfully, False otherwise.
+ """
try:
- subprocess.run(['ctags', '-R', '--c-kinds=+p', '--fields=+S', '--extra=+q', '--languages=c', f'--langmap=c:.c', directory], check=True)
+ subprocess.run(['ctags', '-R', '--c-kinds=+p',
+ '--fields=+S', '--extra=+q',
+ '--languages=c', '--langmap=c:.c',
+ directory], check=True)
return True
except subprocess.CalledProcessError as e:
- print_Ctags_header_error(f"Error generating ctags: {e}")
+ print_ctags_header_error(f"Error generating ctags: {e}")
return False
-def filter_tags(directory,tags_file):
- temp_tags_path = os.path.join(directory,'temp_tags')
- tags_path = os.path.join(directory,tags_file)
- sed_command = r"cat {0} | sed -n 's/^.*\/^\(.*\)/\1/p' | sed 's/\(.*\)\$.*/\1/' | sed 's/;$//' | uniq | sed '/int main(/d' | sed '/.*:/d' | sed 's/$/;/g' > {1}".format(tags_path, temp_tags_path)
-
+
+def filter_tags(directory, tags_file):
+ """
+ Filter the tags file to get only the function prototypes.
+ Args:
+ directory (str): Directory path.
+ tags_file (str): Tags file name.
+ Returns:
+ str: Filtered tags.
+ """
+ temp_tags_path = os.path.join(directory, 'temp_tags')
+ tags_path = os.path.join(directory, tags_file)
+
+ sed_command = (
+ f"cat {tags_path} | sed -n 's/^.*\\/^(.*)/\\1/p' | "
+ "sed 's/(.*)\\$.*/\\1/' | sed 's/;$//' | "
+ "uniq | sed '/int main(/d' | sed '/.*:/d' | "
+ f"sed 's/$/;/g' > {temp_tags_path}"
+ )
+
# Run the sed_command using subprocess
subprocess.run(sed_command, shell=True, check=True)
# Check if the file exists before trying to open it
if os.path.exists(temp_tags_path):
- with open(temp_tags_path, 'r') as temp_tags_file:
+ with open(temp_tags_path, 'r', encoding='utf-8') as temp_tags_file:
filtered_tags = temp_tags_file.read()
return filtered_tags
- else:
- # Handle the case where the file doesn't exist
- msg =f"Error: File {temp_tags_path} does not exist."
- print_Ctags_header_error(msg)
- return None
+
+ # Handle the case where the file doesn't exist
+ msg = f"Error: File {temp_tags_path} does not exist."
+ print_ctags_header_error(msg)
+ return None
+
def create_header(header_file, filtered_tags):
+ """
+ Create a header file with the filtered tags.
+ Args:
+ header_file (str): Header file name.
+ filtered_tags (str): Filtered tags.
+ """
header_name = header_file.split('/')[-1]
- header_name =header_name.split('.')
- header_name= '_'.join(header_name)
- with open(header_file, 'w') as header:
+ header_name = header_name.split('.')
+ header_name = '_'.join(header_name)
+ with open(header_file, 'w', encoding='utf-8') as header:
header.write(f'#ifndef {header_name.upper()}\n')
header.write(f'#define {header_name.upper()}\n\n')
header.write(filtered_tags)
header.write('\n#endif\n')
+
+
def delete_files(tags, temp_tags):
- command = "rm {0} {1}".format(tags, temp_tags)
+ """
+ Delete the tags and temp_tags files.
+ Args:
+ tags (str): Tags file name.
+ temp_tags (str): Temp tags file name.
+ """
+ command = f"rm {tags} {temp_tags}"
subprocess.run(command, shell=True, check=True)
def check_header_file(header_file):
+ """
+ Check if the header file is valid.
+ Args:
+ header_file (str): Header file name.
+ Returns:
+ bool: True if the header file is valid, False otherwise.
+ str: Error message if the header file is invalid.
+ """
if not header_file.endswith('.h'):
-
+
msg = "Error: Invalid header file. It should have a '.h' extension."
- return False , msg
+ return False, msg
return True, None
+
+
def autoproto(directory, header):
- check1, msg1=check_header_file(header)
- check2, msg2=check_ctags()
- if (not check1):
- print_Ctags_header_error(msg1)
- elif (not check2):
- print_Ctags_header_error(msg2)
- if generate_tags(directory) != False:
- filtered_tags = filter_tags(directory, 'tags')
- if filtered_tags != None:
- create_header(header, filtered_tags)
- delete_files('tags', 'temp_tags')
+ """
+ Generate a header file with the prototypes of
+ the functions in the directory.
+ Args:
+ directory (str): Directory path.
+ header (str): Header file name.
+ """
+ check1, msg1 = check_header_file(header)
+ check2, msg2 = check_ctags()
+ if not check1:
+ print_ctags_header_error(msg1)
+ elif not check2:
+ print_ctags_header_error(msg2)
+ if generate_tags(directory) is not False:
+ filtered_tags = filter_tags(directory, 'tags')
+ if filtered_tags is not None:
+ create_header(header, filtered_tags)
+ delete_files('tags', 'temp_tags')
diff --git a/bettyfixer/backup.py b/bettyfixer/backup.py
index 03219c7..4d2d734 100644
--- a/bettyfixer/backup.py
+++ b/bettyfixer/backup.py
@@ -1,15 +1,26 @@
-import shutil # Add the import statement for shutil
+"""
+This module provides a function to create a backup copy of a file.
+"""
+import shutil
+
def create_backup(file_path):
+ """
+ Create a backup copy of the original file.
+ Args:
+ file_path (str): The path of the file to create a backup of.
+ """
try:
- # Create a backup copy of the original file
backup_path = file_path + '.bak'
shutil.copy2(file_path, backup_path)
+ except shutil.SameFileError:
+ print(
+ f"Err creating backup {file_path}: Src and dest are same file.")
except FileNotFoundError:
print(f"Error creating backup for {file_path}: File not found.")
- except Exception as e:
+ except IsADirectoryError:
+ print(f"Error creating backup for {file_path}: Is a directory error.")
+ except PermissionError:
+ print(f"Error creating backup for {file_path}: Permission error.")
+ except OSError as e:
print(f"Unexpected error in create_backup for {file_path}: {e}")
-
-
-
-
\ No newline at end of file
diff --git a/bettyfixer/betty_fixer.py b/bettyfixer/betty_fixer.py
index d8be43a..135fec2 100644
--- a/bettyfixer/betty_fixer.py
+++ b/bettyfixer/betty_fixer.py
@@ -1,41 +1,99 @@
+"""Betty Fixer main module."""
import re
import sys
import os
-from bettyfixer.backup import *
-from bettyfixer.errors_extractor import *
-from bettyfixer.extract_line import *
-from bettyfixer.autoprototype import *
+from bettyfixer.backup import create_backup
+from bettyfixer.errors_extractor import exctract_errors
+from bettyfixer.extract_line import (
+ process_error_file,
+ clean_errors_file,
+ run_vi_script,
+ extract_functions_with_no_description,
+ remove_extra_spaces,
+ remove_unused_attribute,
+ fix_missing_blank_line_after_declarations,
+ fix_should_be_void,
+ fix_brace_should_be_on_the_next_line,
+ fix_brace_should_be_on_the_previous_line,
+ extract_and_print_variables
+)
+from bettyfixer.autoprototype import (
+ betty_check,
+ print_check_betty_first,
+ print_header_name_missing,
+ autoproto
+)
HIDDEN_FILE_NAME = ".processed_files"
+
def read_file(file_path):
- with open(file_path, 'r') as file:
+ """
+ Read the content of the specified file.
+ Args:
+ file_path (str): The path of the file to read.
+ Returns:
+ str: The content of the file.
+ """
+ with open(file_path, 'r', encoding='utf-8') as file:
content = file.read()
return content
+
def write_file(file_path, content):
- with open(file_path, 'w') as file:
+ """
+ Write the specified content to the specified file.
+ Args:
+ file_path (str): The path of the file to write to.
+ content (str): The content to write to the file.
+ """
+ with open(file_path, 'w', encoding='utf-8') as file:
file.write(content)
+
def add_line_without_newline(file_path, line):
+ """
+ Add a line without a newline at the end of the file if not found.
+ Args:
+ file_path (str): The path of the file to add the line to.
+ line (str): The line to add to the file.
+ """
# Add a line without a newline at the end of the file if not found
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
last_line = lines[-1] if lines else ''
if not last_line.strip() == line.strip():
- with open(file_path, 'a') as file:
+ with open(file_path, 'a', encoding='utf-8') as file:
file.write(line)
-
+
+
def remove_consecutive_blank_lines(content):
+ """
+ Remove multiple consecutive blank lines from the specified content.
+ Args:
+ content (str):
+ The content to remove multiple consecutive blank lines from.
+ Returns:
+ str: The content with multiple consecutive blank lines removed.
+ """
# Remove multiple consecutive blank lines
return re.sub('\n{3,}', '\n\n', content)
+
def add_parentheses_around_return(content):
+ """
+ Add parentheses around return values if not already present.
+ Args:
+ content (str): The content to add parentheses around return values to.
+ Returns:
+ str: The content with parentheses around return values added.
+ """
# Add parentheses around return values if not already present
content = re.sub(r'return[ ]+([^(][^;]+);', r'return (\1);', content)
- # Add parentheses around return values if no value is present and not already in parentheses
+ # Add parentheses around return values if no value
+ # is present and not already in parentheses
content = re.sub(r'return[ ]+([^;()]+);', r'return (\1);', content)
# Check if space after semicolon before closing brace '}' is needed
@@ -45,21 +103,53 @@ def add_parentheses_around_return(content):
return content
+
def fix_comments(content):
- # Remove single-line comments (//) found alone in a line or after a code line
- return re.sub(r'([^;])\s*//.*|^\s*//.*', r'\1', content, flags=re.MULTILINE)
+ """
+ Fix comments in the specified content.
+ Args:
+ content (str): The content to fix comments in.
+ Returns:
+ str: The content with comments fixed.
+ """
+ # Remove single-line comments (//) found alone in line or after a code line
+ return re.sub(
+ r'([^;])\s*//.*|^\s*//.*', r'\1', content, flags=re.MULTILINE)
+
def remove_trailing_whitespaces(content):
+ """
+ Remove trailing whitespaces at the end of lines in the specified content.
+ Args:
+ content (str): The content to remove trailing whitespaces from.
+ Returns:
+ str: The content with trailing whitespaces removed.
+ """
# Remove trailing whitespaces at the end of lines
return re.sub(r'[ \t]+$', '', content, flags=re.MULTILINE)
+# ❗ This function doesn't make sense to me [Younis]
def process_errors(file_path):
+ """
+ Process the errors for the specified file.
+ Args:
+ file_path (str): The path of the file to process the errors for.
+ """
# Process the errors for the specified file
- errors_file_path = 'errors.txt'
- process_error_file(errors_file_path)
+ file_path = 'errors.txt'
+ process_error_file(file_path)
+
def fix_betty_warnings(content, file_path):
+ """
+ Fix Betty warnings in the specified content.
+ Args:
+ content (str): The content to fix Betty warnings in.
+ file_path (str): The path of the file to fix Betty warnings in.
+ Returns:
+ str: The file path for further processing.
+ """
# Run Betty and append errors to the common errors.txt file
content = remove_consecutive_blank_lines(content)
clean_errors_file('errors.txt')
@@ -70,28 +160,42 @@ def fix_betty_warnings(content, file_path):
# Return the file path for further processing
return file_path
+
def remove_blank_lines_inside_comments(file_path):
+ """
+ Remove blank lines inside comments in the specified file.
+ Args:
+ file_path (str):
+ The path of the file to remove blank lines inside comments from.
+ """
clean_errors_file('errors.txt')
# Read the content of the file
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find lines starting with '/**' (declaration beginning)
- for i, line in enumerate(lines):
+ for i, line in enumerate(lines): # pylint: disable=too-many-nested-blocks
if line.strip().startswith('/**'):
# Find the next line starting with ' */' (declaration ending)
for j in range(i + 1, len(lines)):
if lines[j].strip().startswith('*/'):
- # Remove any blank lines between declaration beginning and ending
+ # Remove any blank line <- declaration beginning and ending
for k in range(i + 1, j):
if lines[k].strip() == '':
del lines[k]
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
return
+
+
def fix_betty_style(file_paths):
+ """
+ Fix Betty style for the specified file paths.
+ Args:
+ file_paths (list): The list of file paths to fix Betty style for.
+ """
for file_path in file_paths:
create_backup(file_path)
run_vi_script(file_path)
@@ -109,16 +213,17 @@ def fix_betty_style(file_paths):
# Extract functions with no description from 'errors.txt'
errors_file_path = 'errors.txt'
- functions_with_no_description = extract_functions_with_no_description(errors_file_path)
+ functions_with_no_description = extract_functions_with_no_description(
+ errors_file_path)
# Iterate through each line in path_file and remove extra spaces
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
-
+
cleaned_lines = [remove_extra_spaces(line) for line in lines]
# Write the cleaned lines back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(cleaned_lines)
# Generate documentation for each function with no description
@@ -128,7 +233,7 @@ def fix_betty_style(file_paths):
fix_missing_blank_line_after_declarations(errors_file_path)
remove_blank_lines_inside_comments(file_path)
fix_should_be_void(errors_file_path)
- More_than_5_functions_in_the_file(errors_file_path)
+ more_than_5_functions_in_the_file(errors_file_path)
fix_brace_should_be_on_the_next_line(errors_file_path)
fix_brace_should_be_on_the_previous_line(errors_file_path)
content = read_file(file_path)
@@ -137,16 +242,23 @@ def fix_betty_style(file_paths):
betty_handler(errors_file_path)
-
-def More_than_5_functions_in_the_file(errors_file_path):
+# pylint: disable=too-many-locals
+def more_than_5_functions_in_the_file(errors_file_path):
+ """
+ Fix the error 'More than 5 functions in the file' in the specified file.
+ Args:
+ errors_file_path (str):
+ The path of the errors file to fix the error in.
+ """
# Set to True initially to enter the loop
errors_fixed = True
while errors_fixed:
- errors_fixed = False # Reset the flag at the beginning of each iteration
+ errors_fixed = False # Reset flag at the beginning of each iteration
- with open(errors_file_path, 'r') as errors_file:
- # Read all lines at once to allow modification of the list while iterating
+ with open(errors_file_path, 'r', encoding='utf-8') as errors_file:
+ # Read all lines at once to allow
+ # modification of the list while iterating
error_lines = errors_file.readlines()
for error_line in error_lines:
@@ -154,62 +266,98 @@ def More_than_5_functions_in_the_file(errors_file_path):
variables = extract_and_print_variables(error_line)
if len(variables) >= 2:
file_path, _ = variables[:2]
- line_number = 1 # Assuming you want to start from the first line
- with open(file_path, 'r') as file:
+ line_number = 1 # Assume to start from the first line
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
- # Find the next available file name (file1.c, file2.c, etc.)
+ # Find the next avail file name (file1.c, file2.c, ..)
new_file_path = find_available_file_name(file_path)
# Count the /** ... */ blocks
counter = 0
- inside_block = False
+ in_block = False
block_start_line = 0
for idx, line in enumerate(lines):
if line.strip().startswith('/**'):
- inside_block = True
+ in_block = True
block_start_line = idx
- elif inside_block and line.strip().startswith('*/'):
- inside_block = False
+ elif in_block and line.strip().startswith('*/'):
+ in_block = False
counter += 1
if counter == 6:
- # Create a new file with the content from the specified line to the end of the file
- copy_remaining_lines(lines, block_start_line, new_file_path)
+ # Create a new file with the content
+ # from the specified line to end of the file
+ copy_remaining_lines(
+ lines, block_start_line, new_file_path)
# Remove the content from the main file
del lines[block_start_line:]
- # Write the modified content back to the main file
- with open(file_path, 'w') as main_file:
+ # Write the modified content back to main file
+ with open(
+ file_path,
+ 'w',
+ encoding='utf-8'
+ ) as main_file:
main_file.write(''.join(lines))
- # Clean 'errors.txt' before extracting new errors
- open(errors_file_path, 'w').close()
+ # Clean 'errors.txt' before
+ # pylint: disable=consider-using-with
+ open(errors_file_path, 'w',
+ encoding='utf-8').close()
# Update Betty errors in errors.txt
- exctract_errors(new_file_path, errors_file_path)
- errors_fixed = True # Set the flag if a line is fixed
+ exctract_errors(
+ new_file_path, errors_file_path)
+ # Set the flag if line is fixed
+ errors_fixed = True
break
line_number += 1
+
def find_available_file_name(original_file_path):
+ """
+ Find the next available file name based on the specified file path.
+ Args:
+ original_file_path (str):
+ The path of the original file to find
+ the next available file name for.
+ Returns:
+ str: The next available file name based on the original file path.
+ """
base_name, extension = os.path.splitext(original_file_path)
counter = 1
while True:
- # Remove :01d from the format to allow for sequential numbering without leading zeros
+ # Remove :01d from the format to allow for sequential
+ # numbering without leading zeros
new_file_path = f'{base_name}{counter}{extension}'
if not os.path.exists(new_file_path):
return new_file_path
counter += 1
+
def copy_remaining_lines(lines, start_line, new_file_path):
- # Create a new file with the content from the specified line to the end of the file
- with open(new_file_path, 'w') as new_file:
+ """
+ Copy the remaining lines from the specified start line to the new file.
+ Args:
+ lines (list): The list of lines to copy from.
+ start_line (int): The line number to start copying from.
+ new_file_path (str): The path of the new file to copy the lines to.
+ """
+ # Create a new file with content from the specified line to the end of file
+ with open(new_file_path, 'w', encoding='utf-8') as new_file:
new_file.write(''.join(lines[start_line:]))
-
+
def betty_handler(errors_file_path):
- with open(errors_file_path, 'r') as errors_file:
- # Read all lines at once to allow modification of the list while iterating
+ """
+ Handle Betty errors in the specified file.
+ Args:
+ errors_file_path (str):
+ The path of the errors file to handle Betty errors in.
+ """
+ with open(errors_file_path, 'r', encoding='utf-8') as errors_file:
+ # Read all lines at once to allow modification
+ # of the list while iterating
error_lines = errors_file.readlines()
messages = ["More than 40 lines in a function",
@@ -225,7 +373,13 @@ def betty_handler(errors_file_path):
file_path = variables[0]
other_handlers(file_path)
+
def other_handlers(file_path):
+ """
+ Handle other errors in the specified file.
+ Args:
+ file_path (str): The path of the file to handle other errors in.
+ """
errors_file_path = 'errors.txt'
# Your logic code
@@ -240,67 +394,106 @@ def other_handlers(file_path):
# Update Betty errors in errors.txt
exctract_errors(file_path, errors_file_path)
+
def create_tasks_directory():
+ """
+ Create the tasks directory if not found.
+ """
# Create tasks directory if not found
if not os.path.exists("tasks"):
os.makedirs("tasks")
+
def copy_files_to_tasks(files):
+ """
+ Copy the specified files to the tasks directory.
+ Args:
+ files (list): The list of files to copy to the tasks directory.
+ """
# Copy files to tasks directory
for file_path in files:
destination_path = os.path.join("tasks", os.path.basename(file_path))
if not os.path.exists(destination_path):
# Read the content of the file
- with open(file_path, 'r') as source_file:
+ with open(file_path, 'r', encoding='utf-8') as source_file:
content = source_file.readlines()
# Exclude lines starting with #include and ending with '.h"'
- filtered_content = [line for line in content if not line.strip().startswith("#include") or not line.strip().endswith('.h"')]
+ filtered_content = [line for line in content if not line.strip(
+ ).startswith("#include") or not line.strip().endswith('.h"')]
# Write the modified content to the destination file
- with open(destination_path, 'w') as destination_file:
- destination_file.write(''.join(filtered_content))
+ with open(destination_path, 'w', encoding='utf-8') as dest_file:
+ dest_file.write(''.join(filtered_content))
def modify_main_files(files):
+ """
+ Modify the main files to include the specified files.
+ Args:
+ files (list): The list of files to include in the main files.
+ """
# Modify main files
for file_path in files:
# Read the content of the main file
- with open(file_path, 'r') as main_file:
+ with open(file_path, 'r', encoding='utf-8') as main_file:
content = main_file.readlines()
# Keep only lines with #include that end with '.h"'
- include_lines = [line.strip() for line in content if line.strip().startswith("#include") and line.strip().endswith('.h"')]
+ include_lines = [line.strip() for line in content if line.strip(
+ ).startswith("#include") and line.strip().endswith('.h"')]
- # Write the modified content to the main file, adding an empty line at the end
- with open(file_path, 'w') as main_file:
- main_file.write('\n'.join(include_lines + [f'#include "tasks/{os.path.basename(file_path)}"\n']))
+ # Write the modified content to the main file,
+ # adding an empty line at the end
+ with open(file_path, 'w', encoding='utf-8') as main_file:
+ main_file.write('\n'.join(
+ include_lines + [
+ f'#include "tasks/{os.path.basename(file_path)}"\n']))
def record_processed_file(filename):
- with open(HIDDEN_FILE_NAME, 'a') as hidden_file:
+ """
+ Record the specified file as processed.
+ Args:
+ filename (str): The name of the file to record as processed.
+ """
+ with open(HIDDEN_FILE_NAME, 'a', encoding='utf-8') as hidden_file:
hidden_file.write(filename + '\n')
+
def is_file_processed(filename):
+ """
+ Check if the specified file has been processed before.
+ Args:
+ filename (str): The name of the file to check if processed.
+ Returns:
+ bool: True if the file has been processed before, False otherwise.
+ """
if not os.path.exists(HIDDEN_FILE_NAME):
return False
- with open(HIDDEN_FILE_NAME, 'r') as hidden_file:
+ with open(HIDDEN_FILE_NAME, 'r', encoding='utf-8') as hidden_file:
processed_files = hidden_file.read().splitlines()
return filename in processed_files
+
def main():
+ """
+ Main function for the Betty Fixer module.
+ """
if is_file_processed(".processed_files"):
print("The files have already been processed. Skipping.")
sys.exit(1)
if len(sys.argv) < 2:
- print("Usage: python -m betty_fixer_package.betty_fixer file1.c file2.c ...")
+ print(
+ "Usage: python -m betty_fixer_package.betty_fixer\
+ file1.c file2.c ...")
sys.exit(1)
if "-H" in sys.argv and len(sys.argv) > 2:
- v = betty_check()
- if (v == False):
+
+ if not betty_check():
print_check_betty_first()
else:
header = sys.argv[sys.argv.index("-H") + 1]
@@ -314,8 +507,8 @@ def main():
if any(is_file_processed(file) for file in file_paths):
print("One or more files have already been processed. Skipping.")
sys.exit(1)
-
- open('errors.txt', 'w').close()
+ # pylint: disable=consider-using-with
+ open('errors.txt', 'w', encoding='utf-8').close()
# Fix Betty style
fix_betty_style(file_paths)
for file in file_paths:
@@ -326,5 +519,6 @@ def main():
# Delete errors.txt file
os.remove('errors.txt')
+
if __name__ == "__main__":
- main()
\ No newline at end of file
+ main()
diff --git a/bettyfixer/betty_handler.py b/bettyfixer/betty_handler.py
deleted file mode 100644
index 7fb7854..0000000
--- a/bettyfixer/betty_handler.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import os
-import sys
-
-def other_handler(file_path):
- create_tasks_directory()
- copy_files_to_tasks(file_path)
- modify_main_files(file_path)
-
-def create_tasks_directory():
- # Create tasks directory if not found
- if not os.path.exists("tasks"):
- os.makedirs("tasks")
-
-def copy_files_to_tasks(files):
- # Copy files to tasks directory
- for file_path in files:
- destination_path = os.path.join("tasks", os.path.basename(file_path))
- if not os.path.exists(destination_path):
- # Read the content of the file
- with open(file_path, 'r') as source_file:
- content = source_file.readlines()
-
- # Exclude lines starting with #include and ending with '.h"'
- filtered_content = [line for line in content if not line.strip().startswith("#include") or not line.strip().endswith('.h"')]
-
- # Write the modified content to the destination file
- with open(destination_path, 'w') as destination_file:
- destination_file.write(''.join(filtered_content))
-
-def modify_main_files(files):
- # Modify main files
- for file_path in files:
- # Read the content of the main file
- with open(file_path, 'r') as main_file:
- content = main_file.readlines()
-
- # Keep only lines with #include that end with '.h"'
- include_lines = [line.strip() for line in content if line.strip().startswith("#include") and line.strip().endswith('.h"')]
-
- # Write the modified content to the main file, adding an empty line at the end
- with open(file_path, 'w') as main_file:
- main_file.write('\n'.join(include_lines + [f'#include "tasks/{os.path.basename(file_path)}"\n']))
-
-if __name__ == "__main__":
- # Check if the correct number of arguments is provided
- if len(sys.argv) < 2:
- print("Usage: python betty_handler.py file1.c file2.c ...")
- sys.exit(1)
-
- # Create tasks directory if not found
- create_tasks_directory()
-
- # Copy files to tasks directory if not found
- copy_files_to_tasks(sys.argv[1:])
-
- # Modify main files
- modify_main_files(sys.argv[1:])
-
- print("Tasks directory and main files modified successfully.")
diff --git a/bettyfixer/errors_extractor.py b/bettyfixer/errors_extractor.py
index 8a2cfab..4c5a38d 100644
--- a/bettyfixer/errors_extractor.py
+++ b/bettyfixer/errors_extractor.py
@@ -1,25 +1,38 @@
+"""
+Error Extractor module to extract errors from files using Betty style checker.
+"""
import subprocess
import sys
+
def exctract_errors(file_path, output_file):
+ """
+ Extract errors from a file using Betty style checker and append them
+ to common errors.txt file.
+ Args:
+ file_path (str): The path of the file to extract errors from.
+ output_file (str): The path of the common errors.txt file to append the
+ errors to.
+ """
try:
# Run Betty on the specified file
- result = subprocess.run(['betty', file_path], capture_output=True, text=True, check=True)
+ result = subprocess.run(['betty', file_path],
+ capture_output=True, text=True, check=True)
# Extract the output, including errors and warnings
output = result.stdout
# Append the output to the common errors.txt file
- with open(output_file, 'a') as errors_file_path:
+ with open(output_file, 'a', encoding='utf-8') as errors_file_path:
errors_file_path.write(output)
except subprocess.CalledProcessError as e:
# Handle the case when Betty returns a non-zero exit code
- pass
# Append the error output to the common errors.txt file
- with open(output_file, 'a') as errors_file_path:
+ with open(output_file, 'a', encoding='utf-8') as errors_file_path:
errors_file_path.write(e.stdout)
errors_file_path.write(e.stderr)
+
if __name__ == "__main__":
# Check if at least one file path is provided as a command-line argument
if len(sys.argv) < 2:
@@ -27,11 +40,12 @@ def exctract_errors(file_path, output_file):
sys.exit(1)
# Specify the common errors.txt file in the current directory
- errors_file_path = 'errors.txt'
+ ERRORS_FILE_PATH = 'errors.txt'
# Clear the content of the errors.txt file before appending new errors
- open(errors_file_path, 'w').close()
+ with open(ERRORS_FILE_PATH, 'w', encoding='utf-8') as errors_file:
+ errors_file.close()
# Iterate over each file provided as a command-line argument
- for file_path in sys.argv[1:]:
- exctract_errors(file_path, errors_file_path)
+ for fpath in sys.argv[1:]:
+ exctract_errors(fpath, ERRORS_FILE_PATH)
diff --git a/bettyfixer/extract_line.py b/bettyfixer/extract_line.py
index 8e212e2..71e00ba 100644
--- a/bettyfixer/extract_line.py
+++ b/bettyfixer/extract_line.py
@@ -1,16 +1,39 @@
+"""
+Extracts errors from the errors.txt file and fixes them in the specified file
+"""
+# pylint: disable=too-many-lines
import re
import sys
-from bettyfixer.errors_extractor import exctract_errors
import os
import subprocess
+from bettyfixer.errors_extractor import exctract_errors
+
def run_vi_script(filename):
+ """
+ Run the vi command with gg=G using the -c option.
+ Args:
+ filename (str): The path of the file to edit.
+ """
# Specify the file you want to edit
filename = os.path.abspath(filename)
# Run the vi command with gg=G using the -c option
- subprocess.run(['vi', '-c', 'normal! gg=G', '-c', 'wq', filename])
+ try:
+ # if it fails, check=True raise an exception
+ subprocess.run(['vi', '-c', 'normal! gg=G',
+ '-c', 'wq', filename], check=True)
+ except subprocess.CalledProcessError as e:
+ print(f"Error running vi: {e}")
+
def remove_extra_spaces(input_text):
+ """
+ Remove extra spaces from the input text.
+ Args:
+ input_text (str): The input text to remove extra spaces from.
+ Returns:
+ str: The input text with extra spaces removed.
+ """
lines = input_text.split('\n')
cleaned_lines = []
@@ -20,28 +43,54 @@ def remove_extra_spaces(input_text):
cleaned_text = '\n'.join(cleaned_lines)
return cleaned_text
-# Process the errors from the errors.txt file
-def process_error_file(errors_file_path):
- with open(errors_file_path, 'r') as errors_file:
+
+
+def process_error_file(error_file_path):
+ """
+ Process the errors from the errors.txt file.
+ Args:
+ error_file_path (str): The path of the errors.txt file.
+ """
+ with open(error_file_path, 'r', encoding='utf-8') as errors_file:
for error_line in errors_file:
variables = extract_and_print_variables(error_line)
if variables:
file_path, line_number, error_description = variables
fix_errors_from_file(file_path, line_number, error_description)
-
+
+
def extract_and_print_variables(error_line):
+ """
+ Extract and print variables from the error line.
+ Args:
+ error_line (str): The error line to extract variables from.
+ Returns:
+ tuple: A tuple containing the file path, line number,
+ and error description.
+ """
+
# Split the error line to extract variables
parts = error_line.split(":")
if len(parts) >= 3:
# Extracting file path and line number
file_path, line_number, *error_parts = parts
- # Join all parts except the file path and line number to get the error description
+ # Join all parts except the file path and line number
+ # to get the error description
error_description = ":".join(error_parts[1:]).strip()
# Further processing if needed
return file_path.strip(), line_number.strip(), error_description
return None
+
+
def clean_up_line(line):
+ """
+ Remove extra spaces and ensure a single space before and after each word.
+ Args:
+ line (str): The line to clean up.
+ Returns:
+ str: The cleaned up line.
+ """
# Remove extra spaces and ensure a single space before and after each word
cleaned_line = ' '.join(part.strip() for part in line.split(' '))
@@ -50,7 +99,18 @@ def clean_up_line(line):
cleaned_line += '\n'
return cleaned_line
+
+# pylint: disable=too-many-branches
+
+
def fix_errors_from_file(file_path, line_number, error_description):
+ """
+ Fix errors in the specified file.
+ Args:
+ file_path (str): The path of the file to fix errors in.
+ line_number (str): The line number of the error.
+ error_description (str): The description of the error.
+ """
# List of error messages
error_messages = [
"space prohibited between function name and open parenthesis",
@@ -75,105 +135,150 @@ def fix_errors_from_file(file_path, line_number, error_description):
for i, message in enumerate(error_messages):
if message in error_description:
if i == 0:
- fix_space_prohibited_between_function_name_and_open_parenthesis(file_path, line_number, error_description)
+ fix_space_between_func_name_open_parenthesis(
+ file_path, line_number, error_description)
elif i == 1:
- fix_space_prohibited_after_that_open_parenthesis(file_path, line_number, error_description)
+ fix_space_after_that_open_parenthesis(
+ file_path, line_number, error_description)
elif i == 2:
- fix_space_prohibited_before_that_close_parenthesis(file_path, line_number, error_description)
+ fix_space_before_that_close_parenthesis(
+ file_path, line_number, error_description)
elif i == 3:
- fix_space_required_before_the_open_parenthesis(file_path, line_number, error_description)
+ fix_space_required_before_open_parenthesis(
+ file_path, line_number, error_description)
elif i == 4:
- fix_space_prohibited_before_semicolon(file_path, line_number, ';')
+ fix_space_prohibited_before_semicolon(
+ file_path, line_number, ';')
elif i == 5:
- fix_should_be_foo_star_bar(file_path, line_number, error_description)
+ fix_should_be_foo_star_bar(
+ file_path, line_number, error_description)
elif i == 6:
- fix_spaces_prohibited_around_that(file_path, line_number, error_description)
+ fix_spaces_prohibited_around_that(
+ file_path, line_number, error_description)
elif i == 7:
- fix_space_prohibited_after_that(file_path, line_number, error_description)
+ fix_space_prohibited_after_that(
+ file_path, line_number, error_description)
elif i == 8:
- fix_space_prohibited_before_that(file_path, line_number, error_description)
+ fix_space_prohibited_before_that(
+ file_path, line_number, error_description)
elif i == 9:
- fix_spaces_preferred_around_that(file_path, line_number, error_description)
+ fix_spaces_preferred_around_that(
+ file_path, line_number, error_description)
elif i == 10:
- fix_space_required_after_that(file_path, line_number, error_description)
+ fix_space_required_after_that(
+ file_path, line_number, error_description)
elif i == 11:
- fix_space_required_around_that(file_path, line_number, error_description)
+ fix_space_required_around_that(
+ file_path, line_number, error_description)
elif i == 12:
- fix_space_required_before_the_open_brace(file_path, line_number, error_description)
+ fix_space_required_before_the_open_brace(
+ file_path, line_number, error_description)
elif i == 13:
- fix_space_required_after_the_close_brace(file_path, line_number, error_description)
+ fix_space_required_after_the_close_brace(
+ file_path, line_number, error_description)
elif i == 14:
- fix_should_be_foo_star_star_bar(file_path, line_number, error_description)
+ fix_should_be_foo_star_star_bar(
+ file_path, line_number, error_description)
elif i == 15:
run_vi_script(file_path)
-def fix_should_be_void(errors_file_path):
+
+def fix_should_be_void(error_file_path):
+ """
+ Fix errors in the specified file.
+ Args:
+ error_file_path (str): The path of the file to fix errors in.
+ """
errors_fixed = True # Set to True initially to enter the loop
while errors_fixed:
- errors_fixed = False # Reset the flag at the beginning of each iteration
+ errors_fixed = False # Resets flag at the beginning of each iteration
- with open(errors_file_path, 'r') as errors_file:
- # Read all lines at once to allow modification of the list while iterating
+ with open(error_file_path, 'r', encoding='utf-8') as errors_file:
+ # Read all lines at once to allow modification
+ # of the list while iterating
error_lines = errors_file.readlines()
- for error_line in error_lines:
- if 'should probably be' in error_line and '(void)' in error_line:
- # Extract (file_path, line_number) from the error line
- variables = extract_and_print_variables(error_line)
+ for err_line in error_lines:
+ if 'should probably be' in err_line and '(void)' in err_line:
+ # Extract (file_path, line_number) from the err line
+ variables = extract_and_print_variables(err_line)
if len(variables) >= 2:
- file_path, line_number = variables[:2] # Take the first two values
+ # Take the first two values
+ file_path, line_num = variables[:2]
# Fix missing blank line after declaration
- if should_be_void(file_path, line_number, 'errors.txt'):
- errors_fixed = True # Set the flag if a line is fixed
-
-
-def should_be_void(file_path, line_number, errors_file_path):
+ if should_be_void(file_path, line_num, 'errors.txt'):
+ errors_fixed = True # Set flag if line is fixed
+
+
+def should_be_void(file_path, line_number, error_file_path):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_file_path (str): The path of the errors.txt file.
+ Returns:
+ bool: True if the line is fixed, False otherwise.
+ """
# Convert line_number to integer
line_number = int(line_number)
specifier = '()'
replacement = '(void)'
# Read the content of the file
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Replace '()' with '(void)' in the specified line
- lines[line_number - 1] = lines[line_number - 1].replace(specifier, replacement)
+ lines[line_number - 1] = lines[line_number -
+ 1].replace(specifier, replacement)
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-
+
# Clean 'errors.txt' before extracting new errors
- clean_errors_file(errors_file_path)
+ clean_errors_file(error_file_path)
# Update Betty errors in errors.txt
- exctract_errors(file_path, errors_file_path)
+ exctract_errors(file_path, error_file_path)
return True # Line is fixed, return True
-
def clean_errors_file(errors_file_path):
+ """
+ Clean the errors.txt file by removing its content.
+ Args:
+ errors_file_path (str): The path of the errors.txt file to clean.
+ """
errors_file_path = 'errors.txt'
# Clear the content of the errors.txt file before appending new errors
- open(errors_file_path, 'w').close()
+ open(errors_file_path, 'w', # pylint: disable=consider-using-with
+ encoding='utf-8').close()
# Iterate over each file provided as a command-line argument
for file_path in sys.argv[1:]:
exctract_errors(file_path, errors_file_path)
+
def fix_missing_blank_line_after_declarations(errors_file_path):
+ """
+ Fix errors in the specified file.
+ Args:
+ errors_file_path (str): The path of the file to fix errors in.
+ """
errors_fixed = True # Set to True initially to enter the loop
while errors_fixed:
- errors_fixed = False # Reset the flag at the beginning of each iteration
+ errors_fixed = False # Reset flag at the beginning of each iteration
- with open(errors_file_path, 'r') as errors_file:
- # Read all lines at once to allow modification of the list while iterating
+ with open(errors_file_path, 'r', encoding='utf-8') as errors_file:
+ # Read all lines at once to allow
+ # modification of the list while iterating
error_lines = errors_file.readlines()
for error_line in error_lines:
@@ -181,18 +286,29 @@ def fix_missing_blank_line_after_declarations(errors_file_path):
# Extract (file_path, line_number) from the error line
variables = extract_and_print_variables(error_line)
if len(variables) >= 2:
- file_path, line_number = variables[:2] # Take the first two values
+ # Take the first two values
+ fpath, line_num = variables[:2]
# Fix missing blank line after declaration
- if fix_missing_blank_line_after_declaration(file_path, line_number, 'errors.txt'):
- errors_fixed = True # Set the flag if a line is fixed
-
-def fix_missing_blank_line_after_declaration(file_path, line_number, errors_file_path):
+ if fix_ln_after_declare(fpath, line_num, 'errors.txt'):
+ errors_fixed = True # Setflag if line is fixed
+
+
+def fix_ln_after_declare(file_path, line_number, errors_file_path):
+ """
+ Fix missing blank line after declaration.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ errors_file_path (str): The path of the errors.txt file.
+ Returns:
+ bool: True if the line is fixed, False otherwise.
+ """
# Convert line_number to integer
line_number = int(line_number)
# Read the content of the file
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
line_number -= 1
@@ -204,33 +320,41 @@ def fix_missing_blank_line_after_declaration(file_path, line_number, errors_file
lines.insert(int(line_number), '\n')
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-
+
# Clean 'errors.txt' before extracting new errors
clean_errors_file(errors_file_path)
return True # Line is fixed, return True
-def fix_should_be_foo_star_star_bar(file_path, line_number, error_description): #done
+
+def fix_should_be_foo_star_star_bar(file_path, line_number, error_description):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_description (str): The description of the error.
+ """
# Specify the specifier
specifier = '**'
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
# Check conditions and fix the line accordingly
- if f'foo** bar' in error_description:
+ if 'foo** bar' in error_description:
fixed_line = error_line.replace(f'{specifier} ', f' {specifier}')
- elif f'foo ** bar' in error_description:
+ elif 'foo ** bar' in error_description:
fixed_line = error_line.replace(f'{specifier} ', f'{specifier}')
- elif f'foo**bar' in error_description:
+ elif 'foo**bar' in error_description:
fixed_line = error_line.replace(f'{specifier}', f' {specifier}')
- elif f'foo* *bar' in error_description:
+ elif 'foo* *bar' in error_description:
fixed_line = error_line.replace('* *', f' {specifier}')
else:
# If none of the conditions match, return without making changes
@@ -240,77 +364,121 @@ def fix_should_be_foo_star_star_bar(file_path, line_number, error_description):
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
+
def remove_unused_attribute(file_name, function_name):
+ """
+ Remove __attribute__((unused)) from the specified function in the file.
+ Args:
+ file_name (str): The path of the file to remove
+ __attribute__((unused)) from.
+ function_name (str): The name of the function to remove
+ __attribute__((unused)) from.
+ """
try:
- with open(file_name, 'r') as file:
+ with open(file_name, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Search for the function
pattern = r'\b' + re.escape(function_name) + r'\b[^(]*\([^)]*\)'
- function_declarations = {} # Dictionary to store function_name and its original line
+ function_declarations = {} # Dict to store function_name and its line
for i, line in enumerate(lines):
if re.search(pattern, line):
- function_start_line = i
- function_declarations[function_name] = lines[function_start_line] # Save the original line
+ fn_st_line = i # function start line
+ # Save the original line
+ function_declarations[function_name] = lines[fn_st_line]
break
else:
- pass
+ pass
# took a copy from the original function declaration
- original_declaration = lines[function_start_line]
+ # original_declaration = lines[fn_st_line]# ❗ Unused variable [Younis]
# Extract and remove __attribute__((unused))
- match = re.search(r'(__attribute__\s*\(\s*\(\s*unused\s*\)\s*\))', lines[function_start_line])
+ match = re.search(
+ r'(__attribute__\s*\(\s*\(\s*unused\s*\)\s*\))', lines[fn_st_line])
unused_attribute = match.group(1) if match else None
- lines[function_start_line] = re.sub(r'__attribute__\s*\(\s*\(\s*unused\s*\)\s*\)', '', lines[function_start_line])
+ lines[fn_st_line] = re.sub(
+ r'__attribute__\s*\(\s*\(\s*unused\s*\)\s*\)',
+ '',
+ lines[fn_st_line])
# Call the existing function to generate documentation
- generate_documentation(lines, function_start_line, function_name)
+ generate_documentation(lines, fn_st_line, function_name)
# Restore __attribute__((unused))
if unused_attribute:
- lines[function_start_line] = lines[function_start_line].replace(lines[function_start_line].strip(), lines[function_start_line].strip() + ' ' + unused_attribute).strip()
+ lines[fn_st_line] = lines[fn_st_line].\
+ replace(lines[fn_st_line].strip(
+ ), lines[fn_st_line].strip() + ' ' + unused_attribute).strip()
# Write back to the file
- with open(file_name, 'w') as file:
+ with open(file_name, 'w', encoding='utf-8') as file:
file.writelines(lines)
fix_lines_in_file(file_name, function_declarations)
- except Exception as e:
- print(f"Error: {e}")
+ except ValueError as e:
+ print(f"ValueError: {e}")
+ except FileNotFoundError as e:
+ print(f"FileNotFoundError: {e}")
+ except PermissionError as e:
+ print(f"PermissionError: {e}")
+ except OSError as e:
+ print(f"OSError: {e}")
+
def fix_lines_in_file(file_name, function_declarations):
- try:
- with open(file_name, 'r') as file:
+ """
+ Fix the lines in the file.
+ Args:
+ file_name (str): The path of the file to fix the lines in.
+ function_declarations (dict): A dictionary containing
+ the function_name and its original line.
+ """
+ try: # pylint: disable=too-many-nested-blocks
+ with open(file_name, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Iterate through each line in file
- for i, line in enumerate(lines):
- if '*/' in line and 'unused' in line:
- # Check if any function_name is found in this line
- for func_name, original_line in function_declarations.items():
- if func_name in line:
- # Replace the line with the desired format
- lines[i] = f' */\n{original_line}'
-
- # Check if the next line is a blank line; if so, delete it
- if i + 1 < len(lines) and lines[i + 1] == '\n':
- del lines[i + 1]
- break
+ for i, line in enumerate(lines):
+ if '*/' in line and 'unused' in line:
+ # Check if any function_name is found in this line
+ for f_name, original_line in function_declarations.items():
+ if f_name in line:
+ # Replace the line with the desired format
+ lines[i] = f' */\n{original_line}'
+
+ # Check if next line is a blank; if so, delete it
+ if i + 1 < len(lines) and lines[i + 1] == '\n':
+ del lines[i + 1]
+ break
# Write back to the file
- with open(file_name, 'w') as file:
+ with open(file_name, 'w', encoding='utf-8') as file:
file.writelines(lines)
- except Exception as e:
- print(f"Error: {e}")
-
-def generate_documentation(lines, function_start_line, function_name):
+ except ValueError as e:
+ print(f"ValueError: {e}")
+ except FileNotFoundError as e:
+ print(f"FileNotFoundError: {e}")
+ except PermissionError as e:
+ print(f"PermissionError: {e}")
+ except OSError as e:
+ print(f"OSError: {e}")
+
+
+def generate_documentation(lines, fn_start_ln, function_name):
+ """
+ Generate documentation for the specified function in the file.
+ Args:
+ lines (list): A list of lines in the file.
+ fn_start_ln (int): The line number where the function starts.
+ function_name (str): The name of the function to generate documentation
+ """
# Extract function arguments
- args_match = re.search(r'\(([^)]*)\)', lines[function_start_line])
+ args_match = re.search(r'\(([^)]*)\)', lines[fn_start_ln])
if args_match:
# Extract arguments from the updated text
args_text = args_match.group(1).strip()
@@ -319,18 +487,22 @@ def generate_documentation(lines, function_start_line, function_name):
if args_text.lower() == 'void':
arguments = []
else:
- while ')' not in args_text and '\n' not in lines[function_start_line]:
- # Iterate through the remaining lines until a closing parenthesis or a new line is encountered
- function_start_line += 1
- args_text += lines[function_start_line].strip()
-
- # Continue searching for closing parenthesis in the line and take the word before it as the second argument
+ while ')' not in args_text and '\n' not in lines[fn_start_ln]:
+ # Iterate through the remaining lines until a closing '()'
+ # or a new line is encountered
+ fn_start_ln += 1
+ args_text += lines[fn_start_ln].strip()
+
+ # Continue searching for closing parenthesis in the line
+ # and take the word before it as the second argument
closing_parenthesis_pos = args_text.find(')')
if closing_parenthesis_pos != -1:
args_text = args_text[:closing_parenthesis_pos].strip()
arguments = args_text.split(',')
- arguments = [arg.strip().split(' ')[-1].lstrip('*') if '*' in arg else arg.strip().split(' ')[-1] for arg in arguments if arg.strip()]
+ arguments = [arg.strip().split(' ')[-1].
+ lstrip('*') if '*' in arg else arg.strip().
+ split(' ')[-1] for arg in arguments if arg.strip()]
# Create documentation
documentation = []
@@ -338,7 +510,8 @@ def generate_documentation(lines, function_start_line, function_name):
documentation.append(f' * {function_name} - a Function that ...')
if arguments:
for arg in arguments:
- # Correctly identify the second argument as the word before the last closing parenthesis
+ # Correctly identify the second argument as
+ # the word before the last closing parenthesis
if arg == arguments[-1]:
documentation.append(f' * @{arg}: Description of {arg}.')
else:
@@ -347,166 +520,231 @@ def generate_documentation(lines, function_start_line, function_name):
documentation.append(' */\n') # Add a new line after closing '/'
# Insert documentation into the file
- lines.insert(function_start_line, '\n'.join(documentation))
+ lines.insert(fn_start_ln, '\n'.join(documentation))
+
def extract_functions_with_no_description(file_path):
+ """
+ Extract functions with no description from the specified file.
+ Args:
+ file_path (str): The path of the file to extract functions from.
+ Returns:
+ list: A list of functions with no description.
+ """
functions = []
file_path = 'errors.txt'
- with open(file_path, 'r') as errors_file:
+ with open(file_path, 'r', encoding='utf-8') as errors_file:
for line in errors_file:
- # Check if the error description contains 'no description found for function'
+ # Check if the error description contains msg
if 'no description found for function' in line:
- # Split the line by spaces and get the word after 'no description found for function'
+ # Split the line by space and get the word after
+ # 'no description found for function'
words = line.split()
- index = words.index('no') + 5 # Adjust index based on the specific position of the function name
+ # Adjust idx based on specific position of the function name
+ index = words.index('no') + 5
function_name = words[index]
# Append the function name to the list
functions.append(function_name)
return functions
-def fix_space_prohibited_between_function_name_and_open_parenthesis(file_path, line_number, error_description):
- # Extract specifier from error_description
- specifier_index = error_description.find("'") + 1
- specifier = error_description[specifier_index:-1]
+
+
+def fix_space_between_func_name_open_parenthesis(file_path, ln_num, err_desc):
+ """
+ Fix space prohibited between function name and
+ open parenthesis in the specified file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ ln_num (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Extract specifier from err_desc
+ specifier_index = err_desc.find("'") + 1
+ specifier = err_desc[specifier_index:-1]
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
- error_line = lines[int(line_number) - 1]
+ error_line = lines[int(ln_num) - 1]
# Find the specifier in the line and fix it
fixed_line = error_line.replace(f' {specifier}', specifier)
-
+
# Replace the line in the file
- lines[int(line_number) - 1] = fixed_line
+ lines[int(ln_num) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
- file.writelines(lines)
-def fix_space_prohibited_after_that_open_parenthesis(file_path, line_number, error_description):
- # Extract specifier from error_description
- specifier_index = error_description.find("'") + 1
- specifier = error_description[specifier_index:-1]
+ with open(file_path, 'w', encoding='utf-8') as file:
+ file.writelines(lines)
+
+
+def fix_space_after_that_open_parenthesis(file_path, ln_num, err_desc):
+ """
+ Fix space prohibited after that open parenthesis in the specified file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ ln_num (str): The line number to fix.
+ err_desc (str): The description of the error.
+
+ """
+ # Extract specifier from err_desc
+ specifier_index = err_desc.find("'") + 1
+ specifier = err_desc[specifier_index:-1]
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
- error_line = lines[int(line_number) - 1]
+ error_line = lines[int(ln_num) - 1]
# Find the specifier in the line and fix it
fixed_line = error_line.replace(f'{specifier} ', specifier)
# Replace the line in the file
- lines[int(line_number) - 1] = fixed_line
+ lines[int(ln_num) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_prohibited_before_that_close_parenthesis(file_path, line_number, error_description):
- # Extract specifier from error_description
- specifier_index = error_description.find("'") + 1
- specifier = error_description[specifier_index:-1]
+
+
+def fix_space_before_that_close_parenthesis(file_path, ln_num, err_desc):
+ """
+ Fix space prohibited before that close parenthesis in the specified file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ ln_num (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Extract specifier from err_desc
+ specifier_index = err_desc.find("'") + 1
+ specifier = err_desc[specifier_index:-1]
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
- error_line = lines[int(line_number) - 1]
+ error_line = lines[int(ln_num) - 1]
error_line = clean_up_line(error_line)
# Find the specifier in the line and fix it
fixed_line = error_line.replace(f' {specifier}', specifier)
# Replace the line in the file
- lines[int(line_number) - 1] = fixed_line
+ lines[int(ln_num) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_required_before_the_open_parenthesis(file_path, line_number, error_description):
- # Extract specifier from error_description
- specifier_index = error_description.find("'") + 1
- specifier = error_description[specifier_index:-1]
+
+
+def fix_space_required_before_open_parenthesis(file_path, ln_num, err_desc):
+ """
+ Fix space required before the open parenthesis in the specified file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ ln_num (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Extract specifier from err_desc
+ specifier_index = err_desc.find("'") + 1
+ specifier = err_desc[specifier_index:-1]
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
- error_line = lines[int(line_number) - 1]
+ error_line = lines[int(ln_num) - 1]
error_line = clean_up_line(error_line)
# Find the specifier in the line and fix it
fixed_line = error_line.replace(specifier, f' {specifier}')
# Replace the line in the file
- lines[int(line_number) - 1] = fixed_line
+ lines[int(ln_num) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-
+
+
def fix_brace_should_be_on_the_next_line(errors_file_path):
+ """
+ Fix errors in the specified file.
+ Args:
+ errors_file_path (str): The path of the file to fix errors in.
+ """
errors_fixed = True # Set to True initially to enter the loop
while errors_fixed:
- errors_fixed = False # Reset the flag at the beginning of each iteration
+ errors_fixed = False # Reset flag at the beginning of each iteration
- with open(errors_file_path, 'r') as errors_file:
- # Read all lines at once to allow modification of the list while iterating
+ with open(errors_file_path, 'r', encoding='utf-8') as errors_file:
+ # Read all lines at once to allow modification list while iterating
error_lines = errors_file.readlines()
- for i, error_line in enumerate(error_lines):
- if 'that open brace { should be on the next line' in error_line:
+ for i, err_line in enumerate(error_lines):
+ if 'that open brace { should be on the next line' in err_line:
# Extract (file_path, line_number) from the error line
- variables = extract_and_print_variables(error_line)
+ variables = extract_and_print_variables(err_line)
if len(variables) >= 2:
- file_path, line_number = variables[:2] # Take the first two values
+ # Take the first two values
+ f_path, ln_num = variables[:2]
# Fix missing blank line after declaration
- if fix_brace_on_the_next_line(file_path, line_number, 'errors.txt'):
- errors_fixed = True # Set the flag if a line is fixed
+ if fix_brace_next_line(f_path, ln_num, 'errors.txt'):
+ errors_fixed = True # Set flag if a line is fixed
# Add a message in the error line
error_lines[i] += " (brace moved to the next line)"
- elif 'following function declarations go on the next line' in error_line:
- # Extract (file_path, line_number) from the error line
- variables = extract_and_print_variables(error_line)
+ elif ('following function declarations go on '
+ 'the next line') in err_line:
+ # Extract (f_path, ln_num) from the error line
+ variables = extract_and_print_variables(err_line)
if len(variables) >= 2:
- file_path, line_number = variables[:2] # Take the first two values
+ # Take the first two values
+ f_path, ln_num = variables[:2]
# Fix missing blank line after declaration
- if fix_brace_on_the_next_line(file_path, line_number, 'errors.txt'):
- errors_fixed = True # Set the flag if a line is fixed
+ if fix_brace_next_line(f_path, ln_num, 'errors.txt'):
+ errors_fixed = True # Set flag if a line is fixed
# Add a message in the error line
error_lines[i] += " (brace moved to the next line)"
-
-def fix_brace_on_the_next_line(file_path, line_number, errors_file_path):
- # Convert line_number to integer
- line_number = int(line_number)
+def fix_brace_next_line(file_path, ln_num, errors_file_path):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ ln_num (str): The line number to fix.
+ errors_file_path (str): The path of the errors.txt file.
+ Returns:
+ bool: True if the line is fixed, False otherwise.
+ """
+ # Convert ln_num to integer
+ ln_num = int(ln_num)
# Read the content of the file
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Check if the specified line is within the file's range
- if 1 <= line_number <= len(lines):
+ if 1 <= ln_num <= len(lines):
# Find the brace '{' in the line
- line = lines[line_number - 1]
-
+ line = lines[ln_num - 1]
+
# Replace '{' with '\n{' to move it to the next line
- lines[line_number - 1] = line.replace('{', '\n{')
-
+ lines[ln_num - 1] = line.replace('{', '\n{')
+
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
# Clean 'errors.txt' before extracting new errors
@@ -514,14 +752,22 @@ def fix_brace_on_the_next_line(file_path, line_number, errors_file_path):
return True # Line is fixed, return True
- return False
+ return False
+
-
def brace_go_next_line(file_path, line_number, error_description):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_description (str): The description of the error.
+
+ """
specifier = '{'
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
@@ -536,38 +782,60 @@ def brace_go_next_line(file_path, line_number, error_description):
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
+
def fix_brace_should_be_on_the_previous_line(errors_file_path):
+ """
+ Fix errors in the specified file.
+ Args:
+ errors_file_path (str): The path of the file to fix errors in.
+ """
errors_fixed = True # Set to True initially to enter the loop
while errors_fixed:
- errors_fixed = False # Reset the flag at the beginning of each iteration
+ errors_fixed = False # Reset flag at the beginning of each iteration
- with open(errors_file_path, 'r') as errors_file:
- # Read all lines at once to allow modification of the list while iterating
+ with open(errors_file_path, 'r', encoding='utf-8') as errors_file:
+ # Read all lines at once allow modification of list while iterating
error_lines = errors_file.readlines()
for error_line in error_lines:
- if 'that open brace { should be on the previous line' in error_line:
+ if ('that open brace { '
+ 'should be on the previous line') in error_line:
# Extract (file_path, line_number) from the error line
variables = extract_and_print_variables(error_line)
if len(variables) >= 2:
- file_path, line_number = variables[:2] # Take the first two values
+ # Take the first two values
+ file_path, line_number = variables[:2]
# Fix missing blank line after declaration
- if fix_brace_on_the_previous_line(file_path, line_number, 'errors.txt'):
- errors_fixed = True # Set the flag if a line is fixed
+ if fix_brace_on_the_previous_line(
+ file_path,
+ line_number,
+ 'errors.txt'
+ ):
+ errors_fixed = True # Set flag if a line is fixed
+
def fix_brace_on_the_previous_line(file_path, line_number, errors_file_path):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ errors_file_path (str): The path of the errors.txt file.
+ Returns:
+ bool: True if the line is fixed, False otherwise.
+ """
# Convert line_number to integer
line_number = int(line_number)
# Read the content of the file
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
-
+
line_number -= 1
# Find the position of the '{' in the previous line
@@ -577,16 +845,19 @@ def fix_brace_on_the_previous_line(file_path, line_number, errors_file_path):
return False # No '{' found in the previous line, no fix needed
# Remove spaces and newline before the '{'
- lines[line_number] = lines[line_number][:brace_position].rstrip() + '{' + lines[line_number][brace_position + 1:]
+ lines[line_number] = lines[line_number][:brace_position].rstrip(
+ ) + '{' + lines[line_number][brace_position + 1:]
# Delete the previous '\n' character to move the brace to the previous line
if lines[line_number - 1].endswith('\n'):
- lines[line_number - 1] = lines[line_number - 1].rstrip() + ' ' if not lines[line_number - 1].endswith(' ') else lines[line_number - 1].rstrip()
+ lines[line_number - 1] = lines[line_number - 1]\
+ .rstrip() + ' ' if not lines[line_number - 1]\
+ .endswith(' ') else lines[line_number - 1].rstrip()
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-
+
# Clean 'errors.txt' before extracting new errors
clean_errors_file(errors_file_path)
@@ -594,15 +865,21 @@ def fix_brace_on_the_previous_line(file_path, line_number, errors_file_path):
def fix_space_prohibited_before_semicolon(file_path, line_number, specifier):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ specifier (str): The specifier to fix.
+ """
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
-
# Replace any space before the semicolon specifier
fixed_line = error_line.replace(f' {specifier}', specifier)
@@ -610,27 +887,36 @@ def fix_space_prohibited_before_semicolon(file_path, line_number, specifier):
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_should_be_foo_star_bar(file_path, line_number, error_description): #done
+
+
+def fix_should_be_foo_star_bar(file_path, line_number, error_description):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_description (str): The description of the error.
+ """
# Specify the specifier
specifier = '*'
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
# Check conditions and fix the line accordingly
- if f'foo** bar' in error_description:
+ if 'foo** bar' in error_description:
fixed_line = error_line.replace(f'{specifier} ', f' {specifier}')
- elif f'foo* bar' in error_description:
+ elif 'foo* bar' in error_description:
fixed_line = error_line.replace(f'{specifier} ', f' {specifier}')
- elif f'foo * bar' in error_description:
+ elif 'foo * bar' in error_description:
fixed_line = error_line.replace(f'{specifier} ', f'{specifier}')
- elif f'foo*bar' in error_description:
+ elif 'foo*bar' in error_description:
fixed_line = error_line.replace(f'{specifier}', f' {specifier}')
else:
# If none of the conditions match, return without making changes
@@ -640,35 +926,44 @@ def fix_should_be_foo_star_bar(file_path, line_number, error_description): #done
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_spaces_prohibited_around_that(file_path, line_number, error_description):
- # Find the specifier between two single quotes in the error_description
- specifier_start = error_description.find("'") + 1
- specifier_end = error_description.rfind("'")
-
+
+
+def fix_spaces_prohibited_around_that(file_path, line_number, err_desc):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Find the specifier between two single quotes in the err_desc
+ specifier_start = err_desc.find("'") + 1
+ specifier_end = err_desc.rfind("'")
+
if specifier_start < 0 or specifier_end < 0:
# Unable to find valid specifier, return without making changes
return
- specifier = error_description[specifier_start:specifier_end]
+ specifier = err_desc[specifier_start:specifier_end]
- # Extract context from the end of error_description (ctx:context) between : and )
- context_start = error_description.rfind(':') + 1
- context_end = error_description.rfind(')')
+ # Extract context from the end of err_desc (ctx:context) between : and )
+ context_start = err_desc.rfind(':') + 1
+ context_end = err_desc.rfind(')')
if context_start < 0 or context_end < 0:
# Unable to find valid context, return without making changes
return
- context = error_description[context_start:context_end].strip()
+ context = err_desc[context_start:context_end].strip()
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Check if the provided line number is within the valid range
- if not (1 <= int(line_number) <= len(lines)):
+ if not 1 <= int(line_number) <= len(lines):
# Invalid line number, return without making changes
return
@@ -683,28 +978,38 @@ def fix_spaces_prohibited_around_that(file_path, line_number, error_description)
elif context == 'VxW':
fixed_line = error_line.replace(f'{specifier} ', f'{specifier}')
else:
- # If the context doesn't match known conditions, return without making changes
+ # If the context doesn't match known conditions
+ # return without making changes
return
# Replace the line in the file
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_prohibited_after_that(file_path, line_number, error_description): #done
+
+def fix_space_prohibited_after_that(file_path, line_number, error_description):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_description (str): The description of the error.
+ """
# Find the specifier between two single quotes in the error_description
specifier_start = error_description.find("'") + 1
specifier_end = error_description.rfind("'")
-
+
if specifier_start < 0 or specifier_end < 0:
# Unable to find valid specifier, return without making changes
return
specifier = error_description[specifier_start:specifier_end]
- # Extract context from the end of error_description (ctx:context) between : and )
+ # Extract context from the end of error_description
+ # (ctx:context) between : and )
context_start = error_description.rfind(':') + 1
context_end = error_description.rfind(')')
@@ -715,7 +1020,7 @@ def fix_space_prohibited_after_that(file_path, line_number, error_description):
context = error_description[context_start:context_end].strip()
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
@@ -727,84 +1032,104 @@ def fix_space_prohibited_after_that(file_path, line_number, error_description):
elif context == 'ExW':
fixed_line = error_line.replace(f'{specifier} ', f'{specifier}')
else:
- # If the context doesn't match known conditions, return without making changes
+ # If the context doesn't match known conditions,
+ # return without making changes
return
# Replace the line in the file
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_prohibited_before_that(file_path, line_number, error_description):
- # Find the specifier between two single quotes in the error_description
- specifier_start = error_description.find("'") + 1
- specifier_end = error_description.rfind("'")
-
+
+
+def fix_space_prohibited_before_that(file_path, line_number, err_desc):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Find the specifier between two single quotes in the err_desc
+ specifier_start = err_desc.find("'") + 1
+ specifier_end = err_desc.rfind("'")
+
if specifier_start < 0 or specifier_end < 0:
# Unable to find valid specifier, return without making changes
return
- specifier = error_description[specifier_start:specifier_end]
+ specifier = err_desc[specifier_start:specifier_end]
- # Extract context from the end of error_description (ctx:context) between : and )
- context_start = error_description.rfind(':') + 1
- context_end = error_description.rfind(')')
+ # Extract context from the end of err_desc (ctx:context) between : and )
+ context_start = err_desc.rfind(':') + 1
+ context_end = err_desc.rfind(')')
if context_start < 0 or context_end < 0:
# Unable to find valid context, return without making changes
return
- context = error_description[context_start:context_end].strip()
+ context = err_desc[context_start:context_end].strip()
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
# Fix line according to the context conditions
- if context == 'WxV' or context == 'WxO' or context == 'WxE' or context == 'WxW':
+ if context in ['WxV', 'WxO', 'WxE', 'WxW']:
fixed_line = error_line.replace(f' {specifier}', f'{specifier}')
else:
- # If the context doesn't match known conditions, return without making changes
+ # If the context doesn't match known conditions,
+ # return without making changes
return
# Replace the line in the file
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_spaces_preferred_around_that(file_path, line_number, error_description): #done
- # Find the specifier between two single quotes in the error_description
- specifier_start = error_description.find("'") + 1
- specifier_end = error_description.rfind("'")
-
+
+
+def fix_spaces_preferred_around_that(file_path, line_number, err_desc):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Find the specifier between two single quotes in the err_desc
+ specifier_start = err_desc.find("'") + 1
+ specifier_end = err_desc.rfind("'")
+
if specifier_start < 0 or specifier_end < 0:
# Unable to find valid specifier, return without making changes
return
- specifier = error_description[specifier_start:specifier_end]
+ specifier = err_desc[specifier_start:specifier_end]
- # Extract context from the end of error_description (ctx:context) between : and )
- context_start = error_description.rfind(':') + 1
- context_end = error_description.rfind(')')
+ # Extract context from the end of err_desc (ctx:context) between : and )
+ context_start = err_desc.rfind(':') + 1
+ context_end = err_desc.rfind(')')
if context_start < 0 or context_end < 0:
# Unable to find valid context, return without making changes
return
- context = error_description[context_start:context_end].strip()
+ context = err_desc[context_start:context_end].strip()
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
-
+
# Check if the line already satisfies the condition
if f' {specifier} ' in error_line:
# If the required space is already present, skip the fix
@@ -818,27 +1143,38 @@ def fix_spaces_preferred_around_that(file_path, line_number, error_description):
elif context == 'VxW':
fixed_line = error_line.replace(f'{specifier} ', f' {specifier} ')
else:
- # If the context doesn't match known conditions, return without making changes
- return
+ # If the context doesn't match known conditions,
+ # return without making changes
+ return
# Replace the line in the file
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_required_around_that(file_path, line_number, error_description): #done
+
+
+def fix_space_required_around_that(file_path, line_number, error_description):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_description (str): The description of the error.
+ """
# Find the specifier between two single quotes in the error_description
specifier_start = error_description.find("'") + 1
specifier_end = error_description.rfind("'")
-
+
if specifier_start < 0 or specifier_end < 0:
# Unable to find valid specifier, return without making changes
return
specifier = error_description[specifier_start:specifier_end]
- # Extract context from the end of error_description (ctx:context) between : and )
+ # Extract context from the end of
+ # error_description (ctx:context) between : and )
context_start = error_description.rfind(':') + 1
context_end = error_description.rfind(')')
@@ -849,12 +1185,12 @@ def fix_space_required_around_that(file_path, line_number, error_description): #
context = error_description[context_start:context_end].strip()
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
-
+
# Check if the line already satisfies the condition
if f' {specifier} ' in error_line:
# If the required space is already present, skip the fix
@@ -868,27 +1204,38 @@ def fix_space_required_around_that(file_path, line_number, error_description): #
elif context == 'VxW':
fixed_line = error_line.replace(f'{specifier} ', f' {specifier} ')
else:
- # If the context doesn't match known conditions, return without making changes
- return
+ # If the context doesn't match known conditions,
+ # return without making changes
+ return
# Replace the line in the file
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
+
+
def fix_space_required_after_that(file_path, line_number, error_description):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ error_description (str): The description of the error.
+ """
# Find the specifier between two single quotes in the error_description
specifier_start = error_description.find("'") + 1
specifier_end = error_description.rfind("'")
-
+
if specifier_start < 0 or specifier_end < 0:
# Unable to find valid specifier, return without making changes
return
specifier = error_description[specifier_start:specifier_end]
- # Extract context from the end of error_description (ctx:context) between : and )
+ # Extract context from the end of error_description
+ # (ctx:context) between : and )
context_start = error_description.rfind(':') + 1
context_end = error_description.rfind(')')
@@ -899,32 +1246,42 @@ def fix_space_required_after_that(file_path, line_number, error_description):
context = error_description[context_start:context_end].strip()
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
# Fix line according to the context conditions
- if context == 'WxV' or context == 'VxV':
+ if context in ('WxV', 'VxV'):
fixed_line = error_line.replace(f'{specifier}', f'{specifier} ')
else:
- # If the context doesn't match known conditions, return without making changes
+ # If the context doesn't match known conditions,
+ # return without making changes
return
# Replace the line in the file
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_required_before_the_open_brace(file_path, line_number, error_description):
- # Extract specifier from error_description
- specifier_index = error_description.find("'") + 1
- specifier = error_description[specifier_index:-1]
+
+
+def fix_space_required_before_the_open_brace(file_path, line_number, err_desc):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Extract specifier from err_desc
+ specifier_index = err_desc.find("'") + 1
+ specifier = err_desc[specifier_index:-1]
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
@@ -937,34 +1294,40 @@ def fix_space_required_before_the_open_brace(file_path, line_number, error_descr
lines[int(line_number) - 1] = fixed_line
# Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
-def fix_space_required_after_the_close_brace(file_path, line_number, error_description):
- # Extract specifier from error_description
- specifier_index = error_description.find("'") + 1
- specifier = error_description[specifier_index:-1]
+
+
+def fix_space_required_after_the_close_brace(file_path, line_number, err_desc):
+ """
+ Fix the specified line in the file.
+ Args:
+ file_path (str): The path of the file to fix the specified line in.
+ line_number (str): The line number to fix.
+ err_desc (str): The description of the error.
+ """
+ # Extract specifier from err_desc
+ specifier_index = err_desc.find("'") + 1
+ specifier = err_desc[specifier_index:-1]
# Read the file content
- with open(file_path, 'r') as file:
+ with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
# Find the line with the error
error_line = lines[int(line_number) - 1]
error_line = clean_up_line(error_line)
# Find the specifier in the line and fix it
- fixed_line = error_line.replace(specifier, f'{specifier} ')
+ error_line.replace(
+ specifier, f'{specifier} ') # ❗ Unused variable [Younis]
# Replace the line in the file
- lines[int(line_number) - 1] = fixed_line
-
- # Write the modified content back to the file
- with open(file_path, 'w') as file:
+ with open(file_path, 'w', encoding='utf-8') as file:
file.writelines(lines)
# Example usage
if __name__ == "__main__":
-# Assuming you have an errors.txt file with test data
- errors_file_path = 'errors.txt'
- process_error_file(errors_file_path)
-
\ No newline at end of file
+ # Assuming you have an errors.txt file with test data
+ ERROR_FILE_PATH = 'errors.txt'
+ process_error_file(ERROR_FILE_PATH)
diff --git a/errors_logs/autoprototype.txt b/errors_logs/autoprototype.txt
new file mode 100644
index 0000000..e15e8e3
--- /dev/null
+++ b/errors_logs/autoprototype.txt
@@ -0,0 +1,135 @@
+************* Module bettyfixer.autoprototype
+bettyfixer/autoprototype.py:12: [C0301(line-too-long), ] Line too long (124/100)
+bettyfixer/autoprototype.py:28: [C0301(line-too-long), ] Line too long (123/100)
+bettyfixer/autoprototype.py:36: [C0301(line-too-long), ] Line too long (106/100)
+bettyfixer/autoprototype.py:44: [C0301(line-too-long), ] Line too long (143/100)
+bettyfixer/autoprototype.py:53: [C0301(line-too-long), ] Line too long (199/100)
+bettyfixer/autoprototype.py:54: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/autoprototype.py:85: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/autoprototype.py:87: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/autoprototype.py:90: [W0311(bad-indentation), ] Bad indentation. Found 8 spaces, expected 4
+bettyfixer/autoprototype.py:91: [W0311(bad-indentation), ] Bad indentation. Found 8 spaces, expected 4
+bettyfixer/autoprototype.py:92: [W0311(bad-indentation), ] Bad indentation. Found 8 spaces, expected 4
+bettyfixer/autoprototype.py:92: [C0325(superfluous-parens), ] Unnecessary parens after 'if' keyword
+bettyfixer/autoprototype.py:93: [W0311(bad-indentation), ] Bad indentation. Found 12 spaces, expected 8
+bettyfixer/autoprototype.py:94: [W0311(bad-indentation), ] Bad indentation. Found 8 spaces, expected 4
+bettyfixer/autoprototype.py:94: [C0325(superfluous-parens), ] Unnecessary parens after 'elif' keyword
+bettyfixer/autoprototype.py:95: [W0311(bad-indentation), ] Bad indentation. Found 12 spaces, expected 8
+bettyfixer/autoprototype.py:96: [W0311(bad-indentation), ] Bad indentation. Found 8 spaces, expected 4
+bettyfixer/autoprototype.py:97: [W0311(bad-indentation), ] Bad indentation. Found 12 spaces, expected 8
+bettyfixer/autoprototype.py:98: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/autoprototype.py:98: [W0311(bad-indentation), ] Bad indentation. Found 12 spaces, expected 8
+bettyfixer/autoprototype.py:99: [W0311(bad-indentation), ] Bad indentation. Found 16 spaces, expected 12
+bettyfixer/autoprototype.py:100: [W0311(bad-indentation), ] Bad indentation. Found 16 spaces, expected 12
+bettyfixer/autoprototype.py:1: [C0114(missing-module-docstring), ] Missing module docstring
+bettyfixer/autoprototype.py:9: [C0116(missing-function-docstring), betty_check] Missing function or method docstring
+bettyfixer/autoprototype.py:27: [C0116(missing-function-docstring), print_check_betty_first] Missing function or method docstring
+bettyfixer/autoprototype.py:29: [C0116(missing-function-docstring), print_header_name_missing] Missing function or method docstring
+bettyfixer/autoprototype.py:31: [C0116(missing-function-docstring), print_Ctags_header_error] Missing function or method docstring
+bettyfixer/autoprototype.py:31: [C0103(invalid-name), print_Ctags_header_error] Function name "print_Ctags_header_error" doesn't conform to snake_case naming style
+bettyfixer/autoprototype.py:34: [C0116(missing-function-docstring), check_ctags] Missing function or method docstring
+bettyfixer/autoprototype.py:42: [C0116(missing-function-docstring), generate_tags] Missing function or method docstring
+bettyfixer/autoprototype.py:44: [W1309(f-string-without-interpolation), generate_tags] Using an f-string that does not have any interpolated variables
+bettyfixer/autoprototype.py:49: [C0116(missing-function-docstring), filter_tags] Missing function or method docstring
+bettyfixer/autoprototype.py:53: [C0209(consider-using-f-string), filter_tags] Formatting a regular string which could be an f-string
+bettyfixer/autoprototype.py:59: [R1705(no-else-return), filter_tags] Unnecessary "else" after "return", remove the "else" and de-indent the code inside it
+bettyfixer/autoprototype.py:60: [W1514(unspecified-encoding), filter_tags] Using open without explicitly specifying an encoding
+bettyfixer/autoprototype.py:69: [C0116(missing-function-docstring), create_header] Missing function or method docstring
+bettyfixer/autoprototype.py:73: [W1514(unspecified-encoding), create_header] Using open without explicitly specifying an encoding
+bettyfixer/autoprototype.py:78: [C0116(missing-function-docstring), delete_files] Missing function or method docstring
+bettyfixer/autoprototype.py:79: [C0209(consider-using-f-string), delete_files] Formatting a regular string which could be an f-string
+bettyfixer/autoprototype.py:83: [C0116(missing-function-docstring), check_header_file] Missing function or method docstring
+bettyfixer/autoprototype.py:89: [C0116(missing-function-docstring), autoproto] Missing function or method docstring
+bettyfixer/autoprototype.py:96: [C0121(singleton-comparison), autoproto] Comparison 'generate_tags(directory) != False' should be 'generate_tags(directory) is not False' if checking for the singleton value False, or 'generate_tags(directory)' if testing for truthiness
+bettyfixer/autoprototype.py:98: [C0121(singleton-comparison), autoproto] Comparison 'filtered_tags != None' should be 'filtered_tags is not None'
+bettyfixer/autoprototype.py:6: [C0411(wrong-import-order), ] standard import "import glob" should be placed before "from colorama import Fore"
+bettyfixer/autoprototype.py:1: [W0611(unused-import), ] Unused import argparse
+bettyfixer/autoprototype.py:4: [W0611(unused-import), ] Unused import re
+
+
+## Report
+======
+**79 statements analysed.**
+
+Statistics by type
+------------------
+
+|type |number |old number |difference |%documented |%badname |
+|---------|-------|-----------|-----------|------------|---------|
+|module |1 |NC |NC |0.00 |0.00 |
+|class |0 |NC |NC |0 |0 |
+|method |0 |NC |NC |0 |0 |
+|function |11 |NC |NC |0.00 |9.09 |
+
+
+
+External dependencies
+---------------------
+::
+
+ colorama (bettyfixer.autoprototype)
+
+
+
+102 lines have been analyzed
+
+Raw metrics
+-----------
+
+|type |number |% |previous |difference |
+|----------|-------|------|---------|-----------|
+|code |82 |80.39 |NC |NC |
+|docstring |0 |0.00 |NC |NC |
+|comment |5 |4.90 |NC |NC |
+|empty |15 |14.71 |NC |NC |
+
+
+
+Duplication
+-----------
+
+| |now |previous |difference |
+|-------------------------|------|---------|-----------|
+|nb duplicated lines |0 |NC |NC |
+|percent duplicated lines |0.000 |NC |NC |
+
+
+
+Messages by category
+--------------------
+
+|type |number |previous |difference |
+|-----------|-------|---------|-----------|
+|convention |29 |NC |NC |
+|refactor |1 |NC |NC |
+|warning |16 |NC |NC |
+|error |0 |NC |NC |
+
+
+
+Messages
+--------
+
+| message id | occurrences |
+|--------------------------------|-------------|
+| missing-function-docstring | 11 |
+| bad-indentation | 11 |
+| line-too-long | 5 |
+| trailing-whitespace | 4 |
+| unused-import | 2 |
+| unspecified-encoding | 2 |
+| superfluous-parens | 2 |
+| singleton-comparison | 2 |
+| consider-using-f-string | 2 |
+| wrong-import-order | 1 |
+| no-else-return | 1 |
+| missing-module-docstring | 1 |
+| invalid-name | 1 |
+| f-string-without-interpolation | 1 |
+
+
+
+
+-----------------------------------
+Your code has been rated at 4.18/10
+
diff --git a/errors_logs/backup.txt b/errors_logs/backup.txt
new file mode 100644
index 0000000..75fc26a
--- /dev/null
+++ b/errors_logs/backup.txt
@@ -0,0 +1,78 @@
+************* Module bettyfixer.backup
+bettyfixer/backup.py:12: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/backup.py:13: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/backup.py:14: [C0305(trailing-newlines), ] Trailing newlines
+bettyfixer/backup.py:1: [C0114(missing-module-docstring), ] Missing module docstring
+bettyfixer/backup.py:3: [C0116(missing-function-docstring), create_backup] Missing function or method docstring
+bettyfixer/backup.py:10: [W0718(broad-exception-caught), create_backup] Catching too general exception Exception
+
+
+## Report
+======
+**9 statements analysed.**
+
+Statistics by type
+------------------
+
+|type |number |old number |difference |%documented |%badname |
+|---------|-------|-----------|-----------|------------|---------|
+|module |1 |NC |NC |0.00 |0.00 |
+|class |0 |NC |NC |0 |0 |
+|method |0 |NC |NC |0 |0 |
+|function |1 |NC |NC |0.00 |0.00 |
+
+
+
+16 lines have been analyzed
+
+Raw metrics
+-----------
+
+| type | number | % | previous | difference |
+|-----------|--------|-------|----------|------------|
+| code | 11 | 68.75 | NC | NC |
+| docstring | 0 | 0.00 | NC | NC |
+| comment | 1 | 6.25 | NC | NC |
+| empty | 4 | 25.00 | NC | NC |
+
+
+
+Duplication
+-----------
+
+| |now |previous |difference |
+|-------------------------|------|---------|-----------|
+|nb duplicated lines |0 |NC |NC |
+|percent duplicated lines |0.000 |NC |NC |
+
+
+
+Messages by category
+--------------------
+
+|type |number |previous |difference |
+|-----------|-------|---------|-----------|
+|convention |5 |NC |NC |
+|refactor |0 |NC |NC |
+|warning |1 |NC |NC |
+|error |0 |NC |NC |
+
+
+
+Messages
+--------
+
+| message id | occurrences |
+|---------------------------|-------------|
+| trailing-whitespace | 2 |
+| trailing-newlines | 1 |
+| missing-module-docstring | 1 |
+| missing-function-docstring| 1 |
+| broad-exception-caught | 1 |
+
+
+
+
+-----------------------------------
+Your code has been rated at 3.33/10
+
diff --git a/errors_logs/betty_fixer.txt b/errors_logs/betty_fixer.txt
new file mode 100644
index 0000000..5167a52
--- /dev/null
+++ b/errors_logs/betty_fixer.txt
@@ -0,0 +1,168 @@
+************* Module bettyfixer.betty_fixer
+bettyfixer/betty_fixer.py:29: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/betty_fixer.py:117: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/betty_fixer.py:177: [C0301(line-too-long), ] Line too long (115/100)
+bettyfixer/betty_fixer.py:208: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/betty_fixer.py:258: [C0301(line-too-long), ] Line too long (136/100)
+bettyfixer/betty_fixer.py:273: [C0301(line-too-long), ] Line too long (130/100)
+bettyfixer/betty_fixer.py:277: [C0301(line-too-long), ] Line too long (109/100)
+bettyfixer/betty_fixer.py:303: [C0325(superfluous-parens), ] Unnecessary parens after 'if' keyword
+bettyfixer/betty_fixer.py:330: [C0304(missing-final-newline), ] Final newline missing
+bettyfixer/betty_fixer.py:1: [C0114(missing-module-docstring), ] Missing module docstring
+bettyfixer/betty_fixer.py:4: [W0401(wildcard-import), ] Wildcard import bettyfixer.backup
+bettyfixer/betty_fixer.py:5: [W0401(wildcard-import), ] Wildcard import bettyfixer.errors_extractor
+bettyfixer/betty_fixer.py:6: [W0401(wildcard-import), ] Wildcard import bettyfixer.extract_line
+bettyfixer/betty_fixer.py:7: [W0401(wildcard-import), ] Wildcard import bettyfixer.autoprototype
+bettyfixer/betty_fixer.py:11: [C0116(missing-function-docstring), read_file] Missing function or method docstring
+bettyfixer/betty_fixer.py:11: [W0621(redefined-outer-name), read_file] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:12: [W1514(unspecified-encoding), read_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:16: [C0116(missing-function-docstring), write_file] Missing function or method docstring
+bettyfixer/betty_fixer.py:16: [W0621(redefined-outer-name), write_file] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:17: [W1514(unspecified-encoding), write_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:20: [C0116(missing-function-docstring), add_line_without_newline] Missing function or method docstring
+bettyfixer/betty_fixer.py:20: [W0621(redefined-outer-name), add_line_without_newline] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:22: [W1514(unspecified-encoding), add_line_without_newline] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:27: [W1514(unspecified-encoding), add_line_without_newline] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:30: [C0116(missing-function-docstring), remove_consecutive_blank_lines] Missing function or method docstring
+bettyfixer/betty_fixer.py:34: [C0116(missing-function-docstring), add_parentheses_around_return] Missing function or method docstring
+bettyfixer/betty_fixer.py:48: [C0116(missing-function-docstring), fix_comments] Missing function or method docstring
+bettyfixer/betty_fixer.py:52: [C0116(missing-function-docstring), remove_trailing_whitespaces] Missing function or method docstring
+bettyfixer/betty_fixer.py:57: [C0116(missing-function-docstring), process_errors] Missing function or method docstring
+bettyfixer/betty_fixer.py:57: [W0621(redefined-outer-name), process_errors] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:59: [W0621(redefined-outer-name), process_errors] Redefining name 'errors_file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:57: [W0613(unused-argument), process_errors] Unused argument 'file_path'
+bettyfixer/betty_fixer.py:62: [C0116(missing-function-docstring), fix_betty_warnings] Missing function or method docstring
+bettyfixer/betty_fixer.py:62: [W0621(redefined-outer-name), fix_betty_warnings] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:73: [C0116(missing-function-docstring), remove_blank_lines_inside_comments] Missing function or method docstring
+bettyfixer/betty_fixer.py:73: [W0621(redefined-outer-name), remove_blank_lines_inside_comments] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:76: [W1514(unspecified-encoding), remove_blank_lines_inside_comments] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:91: [W1514(unspecified-encoding), remove_blank_lines_inside_comments] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:80: [R1702(too-many-nested-blocks), remove_blank_lines_inside_comments] Too many nested blocks (6/5)
+bettyfixer/betty_fixer.py:94: [C0116(missing-function-docstring), fix_betty_style] Missing function or method docstring
+bettyfixer/betty_fixer.py:95: [W0621(redefined-outer-name), fix_betty_style] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:111: [W0621(redefined-outer-name), fix_betty_style] Redefining name 'errors_file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:115: [W1514(unspecified-encoding), fix_betty_style] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:121: [W1514(unspecified-encoding), fix_betty_style] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:141: [C0116(missing-function-docstring), More_than_5_functions_in_the_file] Missing function or method docstring
+bettyfixer/betty_fixer.py:141: [C0103(invalid-name), More_than_5_functions_in_the_file] Function name "More_than_5_functions_in_the_file" doesn't conform to snake_case naming style
+bettyfixer/betty_fixer.py:141: [R0914(too-many-locals), More_than_5_functions_in_the_file] Too many local variables (17/15)
+bettyfixer/betty_fixer.py:141: [W0621(redefined-outer-name), More_than_5_functions_in_the_file] Redefining name 'errors_file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:156: [W0621(redefined-outer-name), More_than_5_functions_in_the_file] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:148: [W1514(unspecified-encoding), More_than_5_functions_in_the_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:158: [W1514(unspecified-encoding), More_than_5_functions_in_the_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:182: [W1514(unspecified-encoding), More_than_5_functions_in_the_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:185: [R1732(consider-using-with), More_than_5_functions_in_the_file] Consider using 'with' for resource-allocating operations
+bettyfixer/betty_fixer.py:185: [W1514(unspecified-encoding), More_than_5_functions_in_the_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:193: [C0116(missing-function-docstring), find_available_file_name] Missing function or method docstring
+bettyfixer/betty_fixer.py:204: [C0116(missing-function-docstring), copy_remaining_lines] Missing function or method docstring
+bettyfixer/betty_fixer.py:206: [W1514(unspecified-encoding), copy_remaining_lines] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:210: [C0116(missing-function-docstring), betty_handler] Missing function or method docstring
+bettyfixer/betty_fixer.py:210: [W0621(redefined-outer-name), betty_handler] Redefining name 'errors_file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:225: [W0621(redefined-outer-name), betty_handler] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:211: [W1514(unspecified-encoding), betty_handler] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:228: [C0116(missing-function-docstring), other_handlers] Missing function or method docstring
+bettyfixer/betty_fixer.py:228: [W0621(redefined-outer-name), other_handlers] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:229: [W0621(redefined-outer-name), other_handlers] Redefining name 'errors_file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:243: [C0116(missing-function-docstring), create_tasks_directory] Missing function or method docstring
+bettyfixer/betty_fixer.py:248: [C0116(missing-function-docstring), copy_files_to_tasks] Missing function or method docstring
+bettyfixer/betty_fixer.py:250: [W0621(redefined-outer-name), copy_files_to_tasks] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:254: [W1514(unspecified-encoding), copy_files_to_tasks] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:261: [W1514(unspecified-encoding), copy_files_to_tasks] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:265: [C0116(missing-function-docstring), modify_main_files] Missing function or method docstring
+bettyfixer/betty_fixer.py:267: [W0621(redefined-outer-name), modify_main_files] Redefining name 'file_path' from outer scope (line 5)
+bettyfixer/betty_fixer.py:269: [W1514(unspecified-encoding), modify_main_files] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:276: [W1514(unspecified-encoding), modify_main_files] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:280: [C0116(missing-function-docstring), record_processed_file] Missing function or method docstring
+bettyfixer/betty_fixer.py:281: [W1514(unspecified-encoding), record_processed_file] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:284: [C0116(missing-function-docstring), is_file_processed] Missing function or method docstring
+bettyfixer/betty_fixer.py:288: [W1514(unspecified-encoding), is_file_processed] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:292: [C0116(missing-function-docstring), main] Missing function or method docstring
+bettyfixer/betty_fixer.py:303: [C0121(singleton-comparison), main] Comparison 'v == False' should be 'v is False' if checking for the singleton value False, or 'not v' if testing for falsiness
+bettyfixer/betty_fixer.py:318: [R1732(consider-using-with), main] Consider using 'with' for resource-allocating operations
+bettyfixer/betty_fixer.py:318: [W1514(unspecified-encoding), main] Using open without explicitly specifying an encoding
+bettyfixer/betty_fixer.py:4: [W0614(unused-wildcard-import), ] Unused import(s) shutil from wildcard import of bettyfixer.backup
+bettyfixer/betty_fixer.py:5: [W0614(unused-wildcard-import), ] Unused import(s) subprocess, errors_file_path and file_path from wildcard import of bettyfixer.errors_extractor
+bettyfixer/betty_fixer.py:6: [W0614(unused-wildcard-import), ] Unused import(s) clean_up_line, fix_errors_from_file, should_be_void, fix_missing_blank_line_after_declaration, fix_should_be_foo_star_star_bar, fix_lines_in_file, generate_documentation, fix_space_prohibited_between_function_name_and_open_parenthesis, fix_space_prohibited_after_that_open_parenthesis, fix_space_prohibited_before_that_close_parenthesis, fix_space_required_before_the_open_parenthesis, fix_brace_on_the_next_line, brace_go_next_line, fix_brace_on_the_previous_line, fix_space_prohibited_before_semicolon, fix_should_be_foo_star_bar, fix_spaces_prohibited_around_that, fix_space_prohibited_after_that, fix_space_prohibited_before_that, fix_spaces_preferred_around_that, fix_space_required_around_that, fix_space_required_after_that, fix_space_required_before_the_open_brace and fix_space_required_after_the_close_brace from wildcard import of bettyfixer.extract_line
+bettyfixer/betty_fixer.py:7: [W0614(unused-wildcard-import), ] Unused import(s) argparse, glob, print_Ctags_header_error, check_ctags, generate_tags, filter_tags, create_header, delete_files, check_header_file and Fore from wildcard import of bettyfixer.autoprototype
+
+
+ ## Report
+======
+**210 statements analysed.**
+
+Statistics by type
+------------------
+
+|type |number |old number |difference |%documented |%badname |
+|---------|-------|-----------|-----------|------------|---------|
+|module |1 |NC |NC |0.00 |0.00 |
+|class |0 |NC |NC |0 |0 |
+|method |0 |NC |NC |0 |0 |
+|function |22 |NC |NC |0.00 |4.55 |
+
+
+
+**332 lines have been analyzed**
+
+Raw metrics
+-----------
+
+|type |number |% |previous |difference |
+|----------|-------|------|---------|-----------|
+|code |215 |64.76 |NC |NC |
+|docstring |1 |0.30 |NC |NC |
+|comment |50 |15.06 |NC |NC |
+|empty |66 |19.88 |NC |NC |
+
+
+
+Duplication
+-----------
+
+| |now |previous |difference |
+|-------------------------|------|---------|-----------|
+|nb duplicated lines |0 |NC |NC |
+|percent duplicated lines |0.000 |NC |NC |
+
+
+
+Messages by category
+--------------------
+
+|type |number |previous |difference |
+|-----------|-------|---------|-----------|
+|convention |34 |NC |NC |
+|refactor |4 |NC |NC |
+|warning |47 |NC |NC |
+|error |0 |NC |NC |
+
+
+
+Messages
+--------
+
+| message id | occurrences |
+|---------------------------|-------------|
+| missing-function-docstring| 22 |
+| unspecified-encoding | 21 |
+| redefined-outer-name | 17 |
+| wildcard-import | 4 |
+| unused-wildcard-import | 4 |
+| line-too-long | 4 |
+| trailing-whitespace | 3 |
+| consider-using-with | 2 |
+| unused-argument | 1 |
+| too-many-nested-blocks | 1 |
+| too-many-locals | 1 |
+| superfluous-parens | 1 |
+| singleton-comparison | 1 |
+| missing-module-docstring | 1 |
+| missing-final-newline | 1 |
+| invalid-name | 1 |
+
+
+
+
+-----------------------------------
+Your code has been rated at 5.95/10
+
diff --git a/errors_logs/betty_handler.txt b/errors_logs/betty_handler.txt
new file mode 100644
index 0000000..6611154
--- /dev/null
+++ b/errors_logs/betty_handler.txt
@@ -0,0 +1,84 @@
+************* Module bettyfixer.betty_handler
+bettyfixer/betty_handler.py:24: [C0301(line-too-long), ] Line too long (136/100)
+bettyfixer/betty_handler.py:38: [C0301(line-too-long), ] Line too long (130/100)
+bettyfixer/betty_handler.py:42: [C0301(line-too-long), ] Line too long (109/100)
+bettyfixer/betty_handler.py:1: [C0114(missing-module-docstring), ] Missing module docstring
+bettyfixer/betty_handler.py:4: [C0116(missing-function-docstring), other_handler] Missing function or method docstring
+bettyfixer/betty_handler.py:9: [C0116(missing-function-docstring), create_tasks_directory] Missing function or method docstring
+bettyfixer/betty_handler.py:14: [C0116(missing-function-docstring), copy_files_to_tasks] Missing function or method docstring
+bettyfixer/betty_handler.py:20: [W1514(unspecified-encoding), copy_files_to_tasks] Using open without explicitly specifying an encoding
+bettyfixer/betty_handler.py:27: [W1514(unspecified-encoding), copy_files_to_tasks] Using open without explicitly specifying an encoding
+bettyfixer/betty_handler.py:30: [C0116(missing-function-docstring), modify_main_files] Missing function or method docstring
+bettyfixer/betty_handler.py:34: [W1514(unspecified-encoding), modify_main_files] Using open without explicitly specifying an encoding
+bettyfixer/betty_handler.py:41: [W1514(unspecified-encoding), modify_main_files] Using open without explicitly specifying an encoding
+
+
+Report
+------
+33 statements analysed.
+
+Statistics by type
+------------------
+
+|type |number |old number |difference |%documented |%badname |
+|---------|-------|-----------|-----------|------------|---------|
+|module |1 |NC |NC |0.00 |0.00 |
+|class |0 |NC |NC |0 |0 |
+|method |0 |NC |NC |0 |0 |
+|function |4 |NC |NC |0.00 |0.00 |
+
+
+
+
+**61 lines have been analyzed**
+
+**Raw metrics**
+-----------
+
+|type |number |% |previous |difference |
+|----------|-------|------|---------|-----------|
+|code |35 |57.38 |NC |NC |
+|docstring |0 |0.00 |NC |NC |
+|comment |13 |21.31 |NC |NC |
+|empty |13 |21.31 |NC |NC |
+
+
+
+Duplication
+-----------
+
+| |now |previous |difference |
+|-------------------------|------|---------|-----------|
+|nb duplicated lines |0 |NC |NC |
+|percent duplicated lines |0.000 |NC |NC |
+
+
+
+Messages by category
+--------------------
+
+|type |number |previous |difference |
+|-----------|-------|---------|-----------|
+|convention |8 |NC |NC |
+|refactor |0 |NC |NC |
+|warning |4 |NC |NC |
+|error |0 |NC |NC |
+
+
+
+Messages
+--------
+
+|message id |occurrences |
+|---------------------------|------------|
+|unspecified-encoding |4 |
+|missing-function-docstring |4 |
+|line-too-long |3 |
+|missing-module-docstring |1 |
+
+
+
+
+-----------------------------------
+Your code has been rated at 6.36/10
+
diff --git a/errors_logs/errors_exractor.txt b/errors_logs/errors_exractor.txt
new file mode 100644
index 0000000..9065d34
--- /dev/null
+++ b/errors_logs/errors_exractor.txt
@@ -0,0 +1,86 @@
+************* Module bettyfixer.errors_extractor
+bettyfixer/errors_extractor.py:1: [C0114(missing-module-docstring), ] Missing module docstring
+bettyfixer/errors_extractor.py:4: [C0116(missing-function-docstring), exctract_errors] Missing function or method docstring
+bettyfixer/errors_extractor.py:4: [W0621(redefined-outer-name), exctract_errors] Redefining name 'file_path' from outer scope (line 36)
+bettyfixer/errors_extractor.py:13: [W0621(redefined-outer-name), exctract_errors] Redefining name 'errors_file_path' from outer scope (line 30)
+bettyfixer/errors_extractor.py:13: [W1514(unspecified-encoding), exctract_errors] Using open without explicitly specifying an encoding
+bettyfixer/errors_extractor.py:17: [W0107(unnecessary-pass), exctract_errors] Unnecessary pass statement
+bettyfixer/errors_extractor.py:19: [W1514(unspecified-encoding), exctract_errors] Using open without explicitly specifying an encoding
+bettyfixer/errors_extractor.py:30: [C0103(invalid-name), ] Constant name "errors_file_path" doesn't conform to UPPER_CASE naming style
+bettyfixer/errors_extractor.py:33: [R1732(consider-using-with), ] Consider using 'with' for resource-allocating operations
+bettyfixer/errors_extractor.py:33: [W1514(unspecified-encoding), ] Using open without explicitly specifying an encoding
+
+
+## Report
+------
+
+**21 statements analysed.**
+
+Statistics by type
+------------------
+
+|type |number |old number |difference |%documented |%badname |
+|---------|-------|-----------|-----------|------------|---------|
+|module |1 |NC |NC |0.00 |0.00 |
+|class |0 |NC |NC |0 |0 |
+|method |0 |NC |NC |0 |0 |
+|function |1 |NC |NC |0.00 |0.00 |
+
+
+
+**39 lines have been analyzed**
+
+Raw metrics
+-----------
+
+|type |number |% |previous |difference |
+|----------|-------|------|---------|-----------|
+|code |23 |58.97 |NC |NC |
+|docstring |0 |0.00 |NC |NC |
+|comment |9 |23.08 |NC |NC |
+|empty |7 |17.95 |NC |NC |
+
+
+
+Duplication
+-----------
+
+| |now |previous |difference |
+|-------------------------|------|---------|-----------|
+|nb duplicated lines |0 |NC |NC |
+|percent duplicated lines |0.000 |NC |NC |
+
+
+
+Messages by category
+--------------------
+
+|type |number |previous |difference |
+|-----------|-------|---------|-----------|
+|convention |3 |NC |NC |
+|refactor |1 |NC |NC |
+|warning |6 |NC |NC |
+|error |0 |NC |NC |
+
+
+
+Messages
+--------
+
+|message id |occurrences |
+|---------------------------|------------|
+|unspecified-encoding |3 |
+|redefined-outer-name |2 |
+|unnecessary-pass |1 |
+|missing-module-docstring |1 |
+|missing-function-docstring |1 |
+|invalid-name |1 |
+|consider-using-with |1 |
+
+
+
+
+
+-----------------------------------
+Your code has been rated at 5.24/10
+
diff --git a/errors_logs/extract_line.txt b/errors_logs/extract_line.txt
new file mode 100644
index 0000000..14ef1c1
--- /dev/null
+++ b/errors_logs/extract_line.txt
@@ -0,0 +1,247 @@
+************* Module bettyfixer.extract_line
+bettyfixer/extract_line.py:31: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:78: [C0301(line-too-long), ] Line too long (122/100)
+bettyfixer/extract_line.py:80: [C0301(line-too-long), ] Line too long (107/100)
+bettyfixer/extract_line.py:82: [C0301(line-too-long), ] Line too long (109/100)
+bettyfixer/extract_line.py:84: [C0301(line-too-long), ] Line too long (105/100)
+bettyfixer/extract_line.py:148: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:187: [C0301(line-too-long), ] Line too long (106/100)
+bettyfixer/extract_line.py:209: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:259: [C0301(line-too-long), ] Line too long (107/100)
+bettyfixer/extract_line.py:262: [W0311(bad-indentation), ] Bad indentation. Found 16 spaces, expected 12
+bettyfixer/extract_line.py:267: [C0301(line-too-long), ] Line too long (102/100)
+bettyfixer/extract_line.py:269: [C0301(line-too-long), ] Line too long (122/100)
+bettyfixer/extract_line.py:276: [C0301(line-too-long), ] Line too long (180/100)
+bettyfixer/extract_line.py:299: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:310: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:323: [C0301(line-too-long), ] Line too long (110/100)
+bettyfixer/extract_line.py:327: [C0301(line-too-long), ] Line too long (119/100)
+bettyfixer/extract_line.py:333: [C0301(line-too-long), ] Line too long (146/100)
+bettyfixer/extract_line.py:341: [C0301(line-too-long), ] Line too long (104/100)
+bettyfixer/extract_line.py:359: [C0301(line-too-long), ] Line too long (101/100)
+bettyfixer/extract_line.py:361: [C0301(line-too-long), ] Line too long (113/100)
+bettyfixer/extract_line.py:368: [C0301(line-too-long), ] Line too long (111/100)
+bettyfixer/extract_line.py:382: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:388: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:452: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:504: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:507: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:517: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:519: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:570: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:580: [C0301(line-too-long), ] Line too long (117/100)
+bettyfixer/extract_line.py:584: [C0301(line-too-long), ] Line too long (151/100)
+bettyfixer/extract_line.py:589: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:649: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:671: [C0325(superfluous-parens), ] Unnecessary parens after 'not' keyword
+bettyfixer/extract_line.py:700: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:743: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:784: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:807: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:822: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:834: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:857: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:872: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:884: [C0303(trailing-whitespace), ] Trailing whitespace
+bettyfixer/extract_line.py:1: [C0114(missing-module-docstring), ] Missing module docstring
+bettyfixer/extract_line.py:7: [C0116(missing-function-docstring), run_vi_script] Missing function or method docstring
+bettyfixer/extract_line.py:11: [W1510(subprocess-run-check), run_vi_script] 'subprocess.run' used without explicitly defining the value for 'check'.
+bettyfixer/extract_line.py:13: [C0116(missing-function-docstring), remove_extra_spaces] Missing function or method docstring
+bettyfixer/extract_line.py:24: [C0116(missing-function-docstring), process_error_file] Missing function or method docstring
+bettyfixer/extract_line.py:24: [W0621(redefined-outer-name), process_error_file] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:25: [W1514(unspecified-encoding), process_error_file] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:32: [C0116(missing-function-docstring), extract_and_print_variables] Missing function or method docstring
+bettyfixer/extract_line.py:44: [C0116(missing-function-docstring), clean_up_line] Missing function or method docstring
+bettyfixer/extract_line.py:53: [C0116(missing-function-docstring), fix_errors_from_file] Missing function or method docstring
+bettyfixer/extract_line.py:53: [R0912(too-many-branches), fix_errors_from_file] Too many branches (18/12)
+bettyfixer/extract_line.py:110: [C0116(missing-function-docstring), fix_should_be_void] Missing function or method docstring
+bettyfixer/extract_line.py:110: [W0621(redefined-outer-name), fix_should_be_void] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:116: [W1514(unspecified-encoding), fix_should_be_void] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:132: [C0116(missing-function-docstring), should_be_void] Missing function or method docstring
+bettyfixer/extract_line.py:132: [W0621(redefined-outer-name), should_be_void] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:139: [W1514(unspecified-encoding), should_be_void] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:146: [W1514(unspecified-encoding), should_be_void] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:159: [C0116(missing-function-docstring), clean_errors_file] Missing function or method docstring
+bettyfixer/extract_line.py:159: [W0621(redefined-outer-name), clean_errors_file] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:163: [R1732(consider-using-with), clean_errors_file] Consider using 'with' for resource-allocating operations
+bettyfixer/extract_line.py:163: [W1514(unspecified-encoding), clean_errors_file] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:169: [C0116(missing-function-docstring), fix_missing_blank_line_after_declarations] Missing function or method docstring
+bettyfixer/extract_line.py:169: [W0621(redefined-outer-name), fix_missing_blank_line_after_declarations] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:175: [W1514(unspecified-encoding), fix_missing_blank_line_after_declarations] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:190: [C0116(missing-function-docstring), fix_missing_blank_line_after_declaration] Missing function or method docstring
+bettyfixer/extract_line.py:190: [W0621(redefined-outer-name), fix_missing_blank_line_after_declaration] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:195: [W1514(unspecified-encoding), fix_missing_blank_line_after_declaration] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:207: [W1514(unspecified-encoding), fix_missing_blank_line_after_declaration] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:215: [C0116(missing-function-docstring), fix_should_be_foo_star_star_bar] Missing function or method docstring
+bettyfixer/extract_line.py:220: [W1514(unspecified-encoding), fix_should_be_foo_star_star_bar] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:227: [W1309(f-string-without-interpolation), fix_should_be_foo_star_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:229: [W1309(f-string-without-interpolation), fix_should_be_foo_star_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:231: [W1309(f-string-without-interpolation), fix_should_be_foo_star_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:233: [W1309(f-string-without-interpolation), fix_should_be_foo_star_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:243: [W1514(unspecified-encoding), fix_should_be_foo_star_star_bar] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:246: [C0116(missing-function-docstring), remove_unused_attribute] Missing function or method docstring
+bettyfixer/extract_line.py:283: [W0718(broad-exception-caught), remove_unused_attribute] Catching too general exception Exception
+bettyfixer/extract_line.py:248: [W1514(unspecified-encoding), remove_unused_attribute] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:279: [W1514(unspecified-encoding), remove_unused_attribute] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:264: [W0612(unused-variable), remove_unused_attribute] Unused variable 'original_declaration'
+bettyfixer/extract_line.py:286: [C0116(missing-function-docstring), fix_lines_in_file] Missing function or method docstring
+bettyfixer/extract_line.py:308: [W0718(broad-exception-caught), fix_lines_in_file] Catching too general exception Exception
+bettyfixer/extract_line.py:288: [W1514(unspecified-encoding), fix_lines_in_file] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:306: [W1514(unspecified-encoding), fix_lines_in_file] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:287: [R1702(too-many-nested-blocks), fix_lines_in_file] Too many nested blocks (6/5)
+bettyfixer/extract_line.py:311: [C0116(missing-function-docstring), generate_documentation] Missing function or method docstring
+bettyfixer/extract_line.py:352: [C0116(missing-function-docstring), extract_functions_with_no_description] Missing function or method docstring
+bettyfixer/extract_line.py:355: [W1514(unspecified-encoding), extract_functions_with_no_description] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:368: [C0116(missing-function-docstring), fix_space_prohibited_between_function_name_and_open_parenthesis] Missing function or method docstring
+bettyfixer/extract_line.py:374: [W1514(unspecified-encoding), fix_space_prohibited_between_function_name_and_open_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:387: [W1514(unspecified-encoding), fix_space_prohibited_between_function_name_and_open_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:389: [C0116(missing-function-docstring), fix_space_prohibited_after_that_open_parenthesis] Missing function or method docstring
+bettyfixer/extract_line.py:395: [W1514(unspecified-encoding), fix_space_prohibited_after_that_open_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:408: [W1514(unspecified-encoding), fix_space_prohibited_after_that_open_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:410: [C0116(missing-function-docstring), fix_space_prohibited_before_that_close_parenthesis] Missing function or method docstring
+bettyfixer/extract_line.py:416: [W1514(unspecified-encoding), fix_space_prohibited_before_that_close_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:429: [W1514(unspecified-encoding), fix_space_prohibited_before_that_close_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:431: [C0116(missing-function-docstring), fix_space_required_before_the_open_parenthesis] Missing function or method docstring
+bettyfixer/extract_line.py:437: [W1514(unspecified-encoding), fix_space_required_before_the_open_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:450: [W1514(unspecified-encoding), fix_space_required_before_the_open_parenthesis] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:453: [C0116(missing-function-docstring), fix_brace_should_be_on_the_next_line] Missing function or method docstring
+bettyfixer/extract_line.py:453: [W0621(redefined-outer-name), fix_brace_should_be_on_the_next_line] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:459: [W1514(unspecified-encoding), fix_brace_should_be_on_the_next_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:492: [C0116(missing-function-docstring), fix_brace_on_the_next_line] Missing function or method docstring
+bettyfixer/extract_line.py:492: [W0621(redefined-outer-name), fix_brace_on_the_next_line] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:497: [W1514(unspecified-encoding), fix_brace_on_the_next_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:509: [W1514(unspecified-encoding), fix_brace_on_the_next_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:520: [C0116(missing-function-docstring), brace_go_next_line] Missing function or method docstring
+bettyfixer/extract_line.py:524: [W1514(unspecified-encoding), brace_go_next_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:539: [W1514(unspecified-encoding), brace_go_next_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:542: [C0116(missing-function-docstring), fix_brace_should_be_on_the_previous_line] Missing function or method docstring
+bettyfixer/extract_line.py:542: [W0621(redefined-outer-name), fix_brace_should_be_on_the_previous_line] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:548: [W1514(unspecified-encoding), fix_brace_should_be_on_the_previous_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:563: [C0116(missing-function-docstring), fix_brace_on_the_previous_line] Missing function or method docstring
+bettyfixer/extract_line.py:563: [W0621(redefined-outer-name), fix_brace_on_the_previous_line] Redefining name 'errors_file_path' from outer scope (line 968)
+bettyfixer/extract_line.py:568: [W1514(unspecified-encoding), fix_brace_on_the_previous_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:587: [W1514(unspecified-encoding), fix_brace_on_the_previous_line] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:596: [C0116(missing-function-docstring), fix_space_prohibited_before_semicolon] Missing function or method docstring
+bettyfixer/extract_line.py:599: [W1514(unspecified-encoding), fix_space_prohibited_before_semicolon] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:613: [W1514(unspecified-encoding), fix_space_prohibited_before_semicolon] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:615: [C0116(missing-function-docstring), fix_should_be_foo_star_bar] Missing function or method docstring
+bettyfixer/extract_line.py:620: [W1514(unspecified-encoding), fix_should_be_foo_star_bar] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:627: [W1309(f-string-without-interpolation), fix_should_be_foo_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:629: [W1309(f-string-without-interpolation), fix_should_be_foo_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:631: [W1309(f-string-without-interpolation), fix_should_be_foo_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:633: [W1309(f-string-without-interpolation), fix_should_be_foo_star_bar] Using an f-string that does not have any interpolated variables
+bettyfixer/extract_line.py:643: [W1514(unspecified-encoding), fix_should_be_foo_star_bar] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:645: [C0116(missing-function-docstring), fix_spaces_prohibited_around_that] Missing function or method docstring
+bettyfixer/extract_line.py:667: [W1514(unspecified-encoding), fix_spaces_prohibited_around_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:693: [W1514(unspecified-encoding), fix_spaces_prohibited_around_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:696: [C0116(missing-function-docstring), fix_space_prohibited_after_that] Missing function or method docstring
+bettyfixer/extract_line.py:718: [W1514(unspecified-encoding), fix_space_prohibited_after_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:737: [W1514(unspecified-encoding), fix_space_prohibited_after_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:739: [C0116(missing-function-docstring), fix_space_prohibited_before_that] Missing function or method docstring
+bettyfixer/extract_line.py:761: [W1514(unspecified-encoding), fix_space_prohibited_before_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:768: [R1714(consider-using-in), fix_space_prohibited_before_that] Consider merging these comparisons with 'in' by using 'context in ('WxV', 'WxO', 'WxE', 'WxW')'. Use a set instead if elements are hashable.
+bettyfixer/extract_line.py:778: [W1514(unspecified-encoding), fix_space_prohibited_before_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:780: [C0116(missing-function-docstring), fix_spaces_preferred_around_that] Missing function or method docstring
+bettyfixer/extract_line.py:802: [W1514(unspecified-encoding), fix_spaces_preferred_around_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:828: [W1514(unspecified-encoding), fix_spaces_preferred_around_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:830: [C0116(missing-function-docstring), fix_space_required_around_that] Missing function or method docstring
+bettyfixer/extract_line.py:852: [W1514(unspecified-encoding), fix_space_required_around_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:878: [W1514(unspecified-encoding), fix_space_required_around_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:880: [C0116(missing-function-docstring), fix_space_required_after_that] Missing function or method docstring
+bettyfixer/extract_line.py:902: [W1514(unspecified-encoding), fix_space_required_after_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:909: [R1714(consider-using-in), fix_space_required_after_that] Consider merging these comparisons with 'in' by using 'context in ('WxV', 'VxV')'. Use a set instead if elements are hashable.
+bettyfixer/extract_line.py:919: [W1514(unspecified-encoding), fix_space_required_after_that] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:921: [C0116(missing-function-docstring), fix_space_required_before_the_open_brace] Missing function or method docstring
+bettyfixer/extract_line.py:927: [W1514(unspecified-encoding), fix_space_required_before_the_open_brace] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:940: [W1514(unspecified-encoding), fix_space_required_before_the_open_brace] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:942: [C0116(missing-function-docstring), fix_space_required_after_the_close_brace] Missing function or method docstring
+bettyfixer/extract_line.py:948: [W1514(unspecified-encoding), fix_space_required_after_the_close_brace] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:961: [W1514(unspecified-encoding), fix_space_required_after_the_close_brace] Using open without explicitly specifying an encoding
+bettyfixer/extract_line.py:968: [C0103(invalid-name), ] Constant name "errors_file_path" doesn't conform to UPPER_CASE naming style
+bettyfixer/extract_line.py:4: [C0411(wrong-import-order), ] standard import "import os" should be placed before "from bettyfixer.errors_extractor import exctract_errors"
+bettyfixer/extract_line.py:5: [C0411(wrong-import-order), ] standard import "import subprocess" should be placed before "from bettyfixer.errors_extractor import exctract_errors"
+
+
+ ## Report
+
+**522 statements analysed.**
+
+Statistics by type
+------------------
+
+| type | number | old number | difference | %documented | %badname |
+|----------|--------|------------|------------|-------------|----------|
+| module | 1 | 1 | = | 0.00 | 0.00 |
+| class | 0 | NC | NC | 0 | 0 |
+| method | 0 | NC | NC | 0 | 0 |
+| function | 35 | 35 | = | 0.00 | 0.00 |
+
+
+**971 lines have been analyzed**
+
+Raw metrics
+-----------
+
+|type |number |% |previous |difference |
+|----------|-------|------|---------|-----------|
+|code |536 |55.20 |NC |NC |
+|docstring |16 |1.65 |NC |NC |
+|comment |206 |21.22 |NC |NC |
+|empty |213 |21.94 |NC |NC |
+
+
+
+Duplication
+-----------
+
+| |now |previous |difference |
+|-------------------------|------|---------|-----------|
+|nb duplicated lines |0 |0 |0 |
+|percent duplicated lines |0.000 |0.000 |= |
+
+
+
+Messages by category
+--------------------
+
+|type |number |previous |difference |
+|-----------|-------|---------|-----------|
+|convention |82 |82 |82 |
+|refactor |5 |5 |5 |
+|warning |74 |74 |74 |
+|error |0 |0 |0 |
+
+
+
+Messages
+--------
+
+
+| message id | occurrences |
+|------------------------------- | ------------|
+| unspecified-encoding | 51 |
+| missing-function-docstring | 35 |
+| trailing-whitespace | 24 |
+| line-too-long | 18 |
+| redefined-outer-name | 10 |
+| f-string-without-interpolation | 8 |
+| wrong-import-order | 2 |
+| consider-using-in | 2 |
+| broad-exception-caught | 2 |
+| unused-variable | 1 |
+| too-many-nested-blocks | 1 |
+| too-many-branches | 1 |
+| superfluous-parens | 1 |
+| subprocess-run-check | 1 |
+| missing-module-docstring | 1 |
+| invalid-name | 1 |
+| consider-using-with | 1 |
+| bad-indentation | 1 |
+
+
+
+
+
+------------------------------------------------------------------
+Your code has been rated at 6.92/10 (previous run: 6.92/10, +0.00)
+
diff --git a/pylintrc b/pylintrc
new file mode 100644
index 0000000..9a06013
--- /dev/null
+++ b/pylintrc
@@ -0,0 +1,635 @@
+[MAIN]
+
+# Analyse import fallback blocks. This can be used to support both Python 2 and
+# 3 compatible code, which means that the block might have code that exists
+# only in one or another interpreter, leading to false positives when analysed.
+analyse-fallback-blocks=no
+
+# Clear in-memory caches upon conclusion of linting. Useful if running pylint
+# in a server-like mode.
+clear-cache-post-run=no
+
+# Load and enable all available extensions. Use --list-extensions to see a list
+# all available extensions.
+#enable-all-extensions=
+
+# In error mode, messages with a category besides ERROR or FATAL are
+# suppressed, and no reports are done by default. Error mode is compatible with
+# disabling specific errors.
+#errors-only=
+
+# Always return a 0 (non-error) status code, even if lint errors are found.
+# This is primarily useful in continuous integration scripts.
+#exit-zero=
+
+# A comma-separated list of package or module names from where C extensions may
+# be loaded. Extensions are loading into the active Python interpreter and may
+# run arbitrary code.
+extension-pkg-allow-list=
+
+# A comma-separated list of package or module names from where C extensions may
+# be loaded. Extensions are loading into the active Python interpreter and may
+# run arbitrary code. (This is an alternative name to extension-pkg-allow-list
+# for backward compatibility.)
+extension-pkg-whitelist=
+
+# Return non-zero exit code if any of these messages/categories are detected,
+# even if score is above --fail-under value. Syntax same as enable. Messages
+# specified are enabled, while categories only check already-enabled messages.
+fail-on=
+
+# Specify a score threshold under which the program will exit with error.
+fail-under=10
+
+# Interpret the stdin as a python script, whose filename needs to be passed as
+# the module_or_package argument.
+#from-stdin=
+
+# Files or directories to be skipped. They should be base names, not paths.
+ignore=CVS
+
+# Add files or directories matching the regular expressions patterns to the
+# ignore-list. The regex matches against paths and can be in Posix or Windows
+# format. Because '\\' represents the directory delimiter on Windows systems,
+# it can't be used as an escape character.
+ignore-paths=
+
+# Files or directories matching the regular expression patterns are skipped.
+# The regex matches against base names, not paths. The default value ignores
+# Emacs file locks
+ignore-patterns=^\.#
+
+# List of module names for which member attributes should not be checked
+# (useful for modules/projects where namespaces are manipulated during runtime
+# and thus existing member attributes cannot be deduced by static analysis). It
+# supports qualified module names, as well as Unix pattern matching.
+ignored-modules=
+
+# Python code to execute, usually for sys.path manipulation such as
+# pygtk.require().
+#init-hook=
+
+# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
+# number of processors available to use, and will cap the count on Windows to
+# avoid hangs.
+jobs=1
+
+# Control the amount of potential inferred values when inferring a single
+# object. This can help the performance when dealing with large functions or
+# complex, nested conditions.
+limit-inference-results=100
+
+# List of plugins (as comma separated values of python module names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# Minimum Python version to use for version dependent checks. Will default to
+# the version used to run pylint.
+py-version=3.10
+
+# Discover python modules and packages in the file system subtree.
+recursive=no
+
+# Add paths to the list of the source roots. Supports globbing patterns. The
+# source root is an absolute path or a path relative to the current working
+# directory used to determine a package namespace for modules located under the
+# source root.
+source-roots=
+
+# When enabled, pylint would attempt to guess common misconfiguration and emit
+# user-friendly hints instead of false-positive error messages.
+suggestion-mode=yes
+
+# Allow loading of arbitrary C extensions. Extensions are imported into the
+# active Python interpreter and may run arbitrary code.
+unsafe-load-any-extension=no
+
+# In verbose mode, extra non-checker-related info will be displayed.
+#verbose=
+
+
+[BASIC]
+
+# Naming style matching correct argument names.
+argument-naming-style=snake_case
+
+# Regular expression matching correct argument names. Overrides argument-
+# naming-style. If left empty, argument names will be checked with the set
+# naming style.
+#argument-rgx=
+
+# Naming style matching correct attribute names.
+attr-naming-style=snake_case
+
+# Regular expression matching correct attribute names. Overrides attr-naming-
+# style. If left empty, attribute names will be checked with the set naming
+# style.
+#attr-rgx=
+
+# Bad variable names which should always be refused, separated by a comma.
+bad-names=foo,
+ bar,
+ baz,
+ toto,
+ tutu,
+ tata
+
+# Bad variable names regexes, separated by a comma. If names match any regex,
+# they will always be refused
+bad-names-rgxs=
+
+# Naming style matching correct class attribute names.
+class-attribute-naming-style=any
+
+# Regular expression matching correct class attribute names. Overrides class-
+# attribute-naming-style. If left empty, class attribute names will be checked
+# with the set naming style.
+#class-attribute-rgx=
+
+# Naming style matching correct class constant names.
+class-const-naming-style=UPPER_CASE
+
+# Regular expression matching correct class constant names. Overrides class-
+# const-naming-style. If left empty, class constant names will be checked with
+# the set naming style.
+#class-const-rgx=
+
+# Naming style matching correct class names.
+class-naming-style=PascalCase
+
+# Regular expression matching correct class names. Overrides class-naming-
+# style. If left empty, class names will be checked with the set naming style.
+#class-rgx=
+
+# Naming style matching correct constant names.
+const-naming-style=UPPER_CASE
+
+# Regular expression matching correct constant names. Overrides const-naming-
+# style. If left empty, constant names will be checked with the set naming
+# style.
+#const-rgx=
+
+# Minimum line length for functions/classes that require docstrings, shorter
+# ones are exempt.
+docstring-min-length=-1
+
+# Naming style matching correct function names.
+function-naming-style=snake_case
+
+# Regular expression matching correct function names. Overrides function-
+# naming-style. If left empty, function names will be checked with the set
+# naming style.
+#function-rgx=
+
+# Good variable names which should always be accepted, separated by a comma.
+good-names=i,
+ j,
+ k,
+ ex,
+ Run,
+ _
+
+# Good variable names regexes, separated by a comma. If names match any regex,
+# they will always be accepted
+good-names-rgxs=
+
+# Include a hint for the correct naming format with invalid-name.
+include-naming-hint=no
+
+# Naming style matching correct inline iteration names.
+inlinevar-naming-style=any
+
+# Regular expression matching correct inline iteration names. Overrides
+# inlinevar-naming-style. If left empty, inline iteration names will be checked
+# with the set naming style.
+#inlinevar-rgx=
+
+# Naming style matching correct method names.
+method-naming-style=snake_case
+
+# Regular expression matching correct method names. Overrides method-naming-
+# style. If left empty, method names will be checked with the set naming style.
+#method-rgx=
+
+# Naming style matching correct module names.
+module-naming-style=snake_case
+
+# Regular expression matching correct module names. Overrides module-naming-
+# style. If left empty, module names will be checked with the set naming style.
+#module-rgx=
+
+# Colon-delimited sets of names that determine each other's naming style when
+# the name regexes allow several styles.
+name-group=
+
+# Regular expression which should only match function or class names that do
+# not require a docstring.
+no-docstring-rgx=^_
+
+# List of decorators that produce properties, such as abc.abstractproperty. Add
+# to this list to register other decorators that produce valid properties.
+# These decorators are taken in consideration only for invalid-name.
+property-classes=abc.abstractproperty
+
+# Regular expression matching correct type alias names. If left empty, type
+# alias names will be checked with the set naming style.
+#typealias-rgx=
+
+# Regular expression matching correct type variable names. If left empty, type
+# variable names will be checked with the set naming style.
+#typevar-rgx=
+
+# Naming style matching correct variable names.
+variable-naming-style=snake_case
+
+# Regular expression matching correct variable names. Overrides variable-
+# naming-style. If left empty, variable names will be checked with the set
+# naming style.
+#variable-rgx=
+
+
+[CLASSES]
+
+# Warn about protected attribute access inside special methods
+check-protected-access-in-special-methods=no
+
+# List of method names used to declare (i.e. assign) instance attributes.
+defining-attr-methods=__init__,
+ __new__,
+ setUp,
+ asyncSetUp,
+ __post_init__
+
+# List of member names, which should be excluded from the protected access
+# warning.
+exclude-protected=_asdict,_fields,_replace,_source,_make,os._exit
+
+# List of valid names for the first argument in a class method.
+valid-classmethod-first-arg=cls
+
+# List of valid names for the first argument in a metaclass class method.
+valid-metaclass-classmethod-first-arg=mcs
+
+
+[DESIGN]
+
+# List of regular expressions of class ancestor names to ignore when counting
+# public methods (see R0903)
+exclude-too-few-public-methods=
+
+# List of qualified class names to ignore when counting class parents (see
+# R0901)
+ignored-parents=
+
+# Maximum number of arguments for function / method.
+max-args=5
+
+# Maximum number of attributes for a class (see R0902).
+max-attributes=7
+
+# Maximum number of boolean expressions in an if statement (see R0916).
+max-bool-expr=5
+
+# Maximum number of branch for function / method body.
+max-branches=12
+
+# Maximum number of locals for function / method body.
+max-locals=15
+
+# Maximum number of parents for a class (see R0901).
+max-parents=7
+
+# Maximum number of public methods for a class (see R0904).
+max-public-methods=20
+
+# Maximum number of return / yield for function / method body.
+max-returns=6
+
+# Maximum number of statements in function / method body.
+max-statements=50
+
+# Minimum number of public methods for a class (see R0903).
+min-public-methods=2
+
+
+[EXCEPTIONS]
+
+# Exceptions that will emit a warning when caught.
+overgeneral-exceptions=builtins.BaseException,builtins.Exception
+
+
+[FORMAT]
+
+# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
+expected-line-ending-format=
+
+# Regexp for a line that is allowed to be longer than the limit.
+ignore-long-lines=^\s*(# )??$
+
+# Number of spaces of indent required inside a hanging or continued line.
+indent-after-paren=4
+
+# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
+# tab).
+indent-string=' '
+
+# Maximum number of characters on a single line.
+max-line-length=100
+
+# Maximum number of lines in a module.
+max-module-lines=1000
+
+# Allow the body of a class to be on the same line as the declaration if body
+# contains single statement.
+single-line-class-stmt=no
+
+# Allow the body of an if to be on the same line as the test if there is no
+# else.
+single-line-if-stmt=no
+
+
+[IMPORTS]
+
+# List of modules that can be imported at any level, not just the top level
+# one.
+allow-any-import-level=
+
+# Allow explicit reexports by alias from a package __init__.
+allow-reexport-from-package=no
+
+# Allow wildcard imports from modules that define __all__.
+allow-wildcard-with-all=no
+
+# Deprecated modules which should not be used, separated by a comma.
+deprecated-modules=
+
+# Output a graph (.gv or any supported image format) of external dependencies
+# to the given file (report RP0402 must not be disabled).
+ext-import-graph=
+
+# Output a graph (.gv or any supported image format) of all (i.e. internal and
+# external) dependencies to the given file (report RP0402 must not be
+# disabled).
+import-graph=
+
+# Output a graph (.gv or any supported image format) of internal dependencies
+# to the given file (report RP0402 must not be disabled).
+int-import-graph=
+
+# Force import order to recognize a module as part of the standard
+# compatibility libraries.
+known-standard-library=
+
+# Force import order to recognize a module as part of a third party library.
+known-third-party=enchant
+
+# Couples of modules and preferred modules, separated by a comma.
+preferred-modules=
+
+
+[LOGGING]
+
+# The type of string formatting that logging methods do. `old` means using %
+# formatting, `new` is for `{}` formatting.
+logging-format-style=old
+
+# Logging modules to check that the string format arguments are in logging
+# function parameter format.
+logging-modules=logging
+
+
+[MESSAGES CONTROL]
+
+# Only show warnings with the listed confidence levels. Leave empty to show
+# all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE,
+# UNDEFINED.
+confidence=HIGH,
+ CONTROL_FLOW,
+ INFERENCE,
+ INFERENCE_FAILURE,
+ UNDEFINED
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once). You can also use "--disable=all" to
+# disable everything first and then re-enable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use "--disable=all --enable=classes
+# --disable=W".
+disable=raw-checker-failed,
+ bad-inline-option,
+ locally-disabled,
+ file-ignored,
+ suppressed-message,
+ useless-suppression,
+ deprecated-pragma,
+ use-symbolic-message-instead,
+ use-implicit-booleaness-not-comparison-to-string,
+ use-implicit-booleaness-not-comparison-to-zero,
+ duplicate-code
+
+# Enable the message, report, category or checker with the given id(s). You can
+# either give multiple identifier separated by comma (,) or put this option
+# multiple time (only on the command line, not in the configuration file where
+# it should appear only once). See also the "--disable" option for examples.
+enable=
+
+
+[METHOD_ARGS]
+
+# List of qualified names (i.e., library.method) which require a timeout
+# parameter e.g. 'requests.api.get,requests.api.post'
+timeout-methods=requests.api.delete,requests.api.get,requests.api.head,requests.api.options,requests.api.patch,requests.api.post,requests.api.put,requests.api.request
+
+
+[MISCELLANEOUS]
+
+# List of note tags to take in consideration, separated by a comma.
+notes=FIXME,
+ XXX,
+ TODO
+
+# Regular expression of note tags to take in consideration.
+notes-rgx=
+
+
+[REFACTORING]
+
+# Maximum number of nested blocks for function / method body
+max-nested-blocks=5
+
+# Complete name of functions that never returns. When checking for
+# inconsistent-return-statements if a never returning function is called then
+# it will be considered as an explicit return statement and no message will be
+# printed.
+never-returning-functions=sys.exit,argparse.parse_error
+
+
+[REPORTS]
+
+# Python expression which should return a score less than or equal to 10. You
+# have access to the variables 'fatal', 'error', 'warning', 'refactor',
+# 'convention', and 'info' which contain the number of messages in each
+# category, as well as 'statement' which is the total number of statements
+# analyzed. This score is used by the global evaluation report (RP0004).
+evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10))
+
+# Template used to display messages. This is a python new-style format string
+# used to format the message information. See doc for all details.
+msg-template=
+
+# Set the output format. Available formats are: text, parseable, colorized,
+# json2 (improved json format), json (old json format) and msvs (visual
+# studio). You can also give a reporter class, e.g.
+# mypackage.mymodule.MyReporterClass.
+#output-format=
+
+# Tells whether to display a full report or only the messages.
+reports=no
+
+# Activate the evaluation score.
+score=yes
+
+
+[SIMILARITIES]
+
+# Comments are removed from the similarity computation
+ignore-comments=yes
+
+# Docstrings are removed from the similarity computation
+ignore-docstrings=yes
+
+# Imports are removed from the similarity computation
+ignore-imports=yes
+
+# Signatures are removed from the similarity computation
+ignore-signatures=yes
+
+# Minimum lines number of a similarity.
+min-similarity-lines=4
+
+
+[SPELLING]
+
+# Limits count of emitted suggestions for spelling mistakes.
+max-spelling-suggestions=4
+
+# Spelling dictionary name. No available dictionaries : You need to install
+# both the python package and the system dependency for enchant to work.
+spelling-dict=
+
+# List of comma separated words that should be considered directives if they
+# appear at the beginning of a comment and should not be checked.
+spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy:
+
+# List of comma separated words that should not be checked.
+spelling-ignore-words=
+
+# A path to a file that contains the private dictionary; one word per line.
+spelling-private-dict-file=
+
+# Tells whether to store unknown words to the private dictionary (see the
+# --spelling-private-dict-file option) instead of raising a message.
+spelling-store-unknown-words=no
+
+
+[STRING]
+
+# This flag controls whether inconsistent-quotes generates a warning when the
+# character used as a quote delimiter is used inconsistently within a module.
+check-quote-consistency=no
+
+# This flag controls whether the implicit-str-concat should generate a warning
+# on implicit string concatenation in sequences defined over several lines.
+check-str-concat-over-line-jumps=no
+
+
+[TYPECHECK]
+
+# List of decorators that produce context managers, such as
+# contextlib.contextmanager. Add to this list to register other decorators that
+# produce valid context managers.
+contextmanager-decorators=contextlib.contextmanager
+
+# List of members which are set dynamically and missed by pylint inference
+# system, and so shouldn't trigger E1101 when accessed. Python regular
+# expressions are accepted.
+generated-members=
+
+# Tells whether to warn about missing members when the owner of the attribute
+# is inferred to be None.
+ignore-none=yes
+
+# This flag controls whether pylint should warn about no-member and similar
+# checks whenever an opaque object is returned when inferring. The inference
+# can return multiple potential results while evaluating a Python object, but
+# some branches might not be evaluated, which results in partial inference. In
+# that case, it might be useful to still emit no-member and other checks for
+# the rest of the inferred objects.
+ignore-on-opaque-inference=yes
+
+# List of symbolic message names to ignore for Mixin members.
+ignored-checks-for-mixins=no-member,
+ not-async-context-manager,
+ not-context-manager,
+ attribute-defined-outside-init
+
+# List of class names for which member attributes should not be checked (useful
+# for classes with dynamically set attributes). This supports the use of
+# qualified names.
+ignored-classes=optparse.Values,thread._local,_thread._local,argparse.Namespace
+
+# Show a hint with possible names when a member name was not found. The aspect
+# of finding the hint is based on edit distance.
+missing-member-hint=yes
+
+# The minimum edit distance a name should have in order to be considered a
+# similar match for a missing member name.
+missing-member-hint-distance=1
+
+# The total number of similar names that should be taken in consideration when
+# showing a hint for a missing member.
+missing-member-max-choices=1
+
+# Regex pattern to define which classes are considered mixins.
+mixin-class-rgx=.*[Mm]ixin
+
+# List of decorators that change the signature of a decorated function.
+signature-mutators=
+
+
+[VARIABLES]
+
+# List of additional names supposed to be defined in builtins. Remember that
+# you should avoid defining new builtins when possible.
+additional-builtins=
+
+# Tells whether unused global variables should be treated as a violation.
+allow-global-unused-variables=yes
+
+# List of names allowed to shadow builtins
+allowed-redefined-builtins=
+
+# List of strings which can identify a callback function by name. A callback
+# name must start or end with one of those strings.
+callbacks=cb_,
+ _cb
+
+# A regular expression matching the name of dummy variables (i.e. expected to
+# not be used).
+dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
+
+# Argument names that match this expression will be ignored.
+ignored-argument-names=_.*|^ignored_|^unused_
+
+# Tells whether we should check for unused import in __init__ files.
+init-import=no
+
+# List of qualified module names which can have objects that can redefine
+# builtins.
+redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
diff --git a/setup.py b/setup.py
index b606e1d..04d7c80 100644
--- a/setup.py
+++ b/setup.py
@@ -1,10 +1,13 @@
-from setuptools import setup, find_packages
-from setuptools.command.install import install
+"""
+This file is used to package the bettyfixer tool and install it in the system.
+"""
+# import subprocess
+# import time
+# import shutil
from pathlib import Path
-import subprocess
-import time
-import shutil
-
+from setuptools import setup, find_packages
+# from setuptools.command.install import install
+
setup(
name='bettyfixer',
version='1.4.6',
@@ -22,8 +25,12 @@
],
author='Moealsir',
author_email='mohamedwdalsir@gmail.com',
- description='Betty Fixer is a tool designed to automatically fix coding style issues in C files based on the Betty coding style guidelines. It performs corrections to ensure that the code complies with the Betty style, making it more readable and consistent.',
- url='https://github.com/Moealsir/betty_fixer', # Replace with your GitHub repository URL
+ description='Betty Fixer is a tool designed to automatically fix coding style \
+issues in C files based on the Betty coding style guidelines.\
+It performs corrections to ensure that the code complies with the Betty style, \
+making it more readable and consistent.',
+ # Replace with your GitHub repository URL
+ url='https://github.com/Moealsir/betty_fixer',
license='MIT', # Replace with your desired license
long_description=(Path(__file__).parent / "README.md").read_text(),