Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some source files have no documentation #952

Closed
Beliavsky opened this issue Mar 18, 2025 · 3 comments
Closed

Some source files have no documentation #952

Beliavsky opened this issue Mar 18, 2025 · 3 comments

Comments

@Beliavsky
Copy link

Some of the Fortran sources have no comments, for example https://github.com/fortran-lang/stdlib/blob/stdlib-fpm/src/stdlib_stats_corr.f90. I think this was auto-generated with fypp. Does that preclude it from having comments?

@jalvesz
Copy link
Contributor

jalvesz commented Mar 18, 2025

@Beliavsky if you look at the original code https://github.com/fortran-lang/stdlib/blob/master/src/stdlib_stats_corr.fypp It has not documentation. fypp enables copying the doc strings, but the problem is simpler, there is no docs to start with

@Beliavsky
Copy link
Author

Maybe there should be a rule that no new .fypp or .f90 source file should be committed if it lacks comments. Excluding the source code in the example directory, a list of source files without comments is.

\src\blas\temp\stdlib_blas.f90
\src\lapack\temp\stdlib_lapack_base.f90
\src\lapack\temp\stdlib_lapack_eig_svd_lsq.f90
\src\lapack\temp\stdlib_lapack_orthogonal_factors.f90
\src\lapack\temp\stdlib_lapack_others.f90
\src\lapack\temp\stdlib_lapack_solve.f90
\src\temp\stdlib_linalg_cross_product.f90
\src\temp\stdlib_linalg_diag.f90
\src\temp\stdlib_linalg_outer_product.f90
\src\temp\stdlib_math_all_close.f90
\src\temp\stdlib_math_is_close.f90
\src\temp\stdlib_math_meshgrid.f90
\src\temp\stdlib_stats_corr.f90
\src\temp\stdlib_stats_cov.f90
\src\temp\stdlib_stats_mean.f90
\src\temp\stdlib_stats_moment.f90
\src\temp\stdlib_stats_moment_all.f90
\src\temp\stdlib_stats_moment_mask.f90
\src\temp\stdlib_stats_moment_scalar.f90
\src\temp\stdlib_stats_var.f90
\test\stats\test_corr.f90

A Python script to find such files is

import os

# Set variables (you can modify these)
extension = '.f90'
search_string = '!'
output_file = 'file_list.txt'

# Function to check if file contains the search string
def contains_string(file_path, search_str):
    try:
        with open(file_path, 'r', encoding='utf-8') as file:
            return search_str in file.read()
    except (IOError, UnicodeDecodeError):
        # Skip files that can't be read (binary files or permission issues)
        return False

# Collect matching files
matching_files = []
for root, dirs, files in os.walk('.'):
    for file in files:
        if file.endswith(extension):
            full_path = os.path.abspath(os.path.join(root, file))
            if not contains_string(full_path, search_string):
                matching_files.append(full_path)

# Write results to output file
with open(output_file, 'w', encoding='utf-8') as f:
    for file_path in matching_files:
        f.write(f"{file_path}\n")

print(f"List created in {output_file}")
print(f"Full paths of {extension} files without '{search_string}' have been saved.")

@perazz
Copy link
Member

perazz commented Mar 22, 2025

@Beliavsky @jalvesz, I will include this discussion as part of #944, that also deals with documentation improvement. Thank you.

@perazz perazz closed this as completed Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants