Skip to content

Fix/header typos

Jacques Xing requested to merge fix/header-typos into master

Issue/feature addressed

There are many errors in the header section of *.cpp, *.h, and *.hpp files. Also, there are inconsistencies between files. Some header does not have a colon ":" in "File: Filename.cpp"

Proposed solution

The proposed solution is to use bash scripts to determine/correct the problematic files.

Implementation

For reference, here is the bash scrip used to determine files with header containing wrong file names.

#!/bin/bash
for file in $(find -type f); do
    filename=${file##*/}
    if [[ ! $(grep -F "$filename" $file) ]]; then
        if [[ "${filename##*.}" == "h" ]]; then
            echo $filename does not contains file name
            echo $file >> outfile.log
        fi
        if [[ "${filename##*.}" == "cpp" ]]; then
            echo $filename does not contains file name
            echo $file >> outfile.log
        fi
        if [[ "${filename##*.}" == "hpp" ]]; then
            echo $filename does not contains file name
            echo $file >> outfile.log
        fi
    fi
done

For reference, here is the bash scrip used to add the missing colon

#!/bin/bash
for file in $(find -type f); do
    filename=${file##*/}
    if [[ $(grep -F "File $filename" $file) ]]; then
        if [[ "${filename##*.}" == "h" ]]; then
            sed -i "/\/\/ File $filename/c\\/\/ File: $filename" $file
        fi
        if [[ "${filename##*.}" == "cpp" ]]; then
            sed -i "/\/\/ File $filename/c\\/\/ File: $filename" $file
        fi
        if [[ "${filename##*.}" == "hpp" ]]; then
            sed -i "/\/\/ File $filename/c\\/\/ File: $filename" $file
        fi
    fi
done

For reference, the following bash script can be used to determine if MIT License is missing

#!/bin/bash
for file in $(find -type f); do
    filename=${file##*/}
    if [[ ! $(grep -F "MIT License" $file) ]]; then
        if [[ "${filename##*.}" == "h" ]]; then
            echo $filename does not contains MIT License
            echo $file >> outfile.log
        fi
        if [[ "${filename##*.}" == "cpp" ]]; then
            echo $filename does not contains MIT License
            echo $file >> outfile.log
        fi
        if [[ "${filename##*.}" == "hpp" ]]; then
            echo $filename does not contains MIT License
            echo $file >> outfile.log
        fi
    fi
done

Checklist

Warning

On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master branch. To resolve these conflicts , see #295 (closed)

Edited by Jacques Xing

Merge request reports