BlueBrain / hpc-coding-conventions

Apache License 2.0
8 stars 5 forks source link

Issues while using clang-format with NEURON project #63

Closed pramodk closed 2 years ago

pramodk commented 4 years ago

I am creating this single placeholder ticket to summarise the issues I have seen while using this project with NEURON:

→ cmake .. -DPYTHON_EXECUTABLE=`which python3.7` -DNEURON_FORMATTING:BOOL=ON -DNRN_ENABLE_CORENEURON=OFF -DNRN_ENABLE_INTERVIEWS=OFF
....
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    NEURON_FORMATTING

Am I missing something obvious here?

→ cmake .. -DPYTHON_EXECUTABLE=`which python3.7` -DNEURON_CMAKE_FORMAT=ON  -DNEURON_CLANG_FORMAT=ON -DNRN_ENABLE_CORENEURON=OFF -DNRN_ENABLE_INTERVIEWS=OFF
...
-- Sub-module : missing external/coding-conventions : running git submodule update --init --recursive
-- NEURON_FORMATTING: OFF
-- NEURON_FORMATTING_ON: all
-- NEURON_FORMATTING_CPP_CHANGES_ONLY: OFF
-- NEURON_TEST_FORMATTING: OFF
-- NEURON_FORMATTING_NO_SUBMODULES: ON
-- NEURON_CLANG_FORMAT: ON
-- NEURON_CMAKE_FORMAT: ON
-- NEURON_PRECOMMIT: OFF
-- NEURON_PRECOMMIT_REGEN: OFF
-- NEURON_STATIC_ANALYSIS: OFF
-- NEURON_TEST_STATIC_ANALYSIS: OFF

All good. But if I try use clang-format target then:

→ make clang-format
Scanning dependencies of target clang-format
Could not find file /Users/kumbhar/workarena/repos/bbp/nn/build/compile_commands.json. Please make sure CMAKE_EXPORT_COMPILE_COMMANDS CMake variable is on.
Traceback (most recent call last):
  File "/Users/kumbhar/workarena/repos/bbp/nn/external/coding-conventions/cpp/cmake/bbp-clang-format.py", line 257, in <module>
    sys.exit(0 if main() else 1)
  File "/Users/kumbhar/workarena/repos/bbp/nn/external/coding-conventions/cpp/cmake/bbp-clang-format.py", line 248, in main
    args, collect_files(args.compile_commands_file, filter_cpp_file)
  File "/Users/kumbhar/workarena/repos/bbp/nn/external/coding-conventions/cpp/cmake/cpplib.py", line 241, in filter_files_outside_time_range
    for file in generator:
  File "/Users/kumbhar/workarena/repos/bbp/nn/external/coding-conventions/cpp/cmake/cpplib.py", line 269, in collect_files
    raise Exception(msg)
Exception: Could not find file /Users/kumbhar/workarena/repos/bbp/nn/build/compile_commands.json. Please make sure CMAKE_EXPORT_COMPILE_COMMANDS CMake variable is on.

So I continue by setting above variable:

→ cmake .. -DPYTHON_EXECUTABLE=`which python3.7` -DNEURON_CMAKE_FORMAT=ON  -DNEURON_CLANG_FORMAT=ON -DNRN_ENABLE_CORENEURON=OFF -DNRN_ENABLE_INTERVIEWS=OFF -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
tristan0x commented 2 years ago

I am closing this issue since formatting is not using of CMake nor a compilation database (file compile_commands.json) anymore.