diff --git a/docker/ubuntu_20_04_base b/docker/ubuntu_20_04_base index 2563640e9a1ff28fe8e8db3128de638914cd2204..c592989598ee091fa3b0966d88cc6cb818bffaaa 100644 --- a/docker/ubuntu_20_04_base +++ b/docker/ubuntu_20_04_base @@ -18,4 +18,4 @@ RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get upgrade - && ln -sf clang-tidy-12 /usr/bin/clang-tidy \ # 20220624: The latest GCOVR (5.1) is broken, so use 5.0. # jinja2<3.1 is required for the html details of GCOVR 5.0 - && python3 -m pip install gcovr==5.0 'jinja2<3.1' cmake-format \ No newline at end of file + && python3 -m pip install gcovr==5.0 'jinja2<3.1' cmake-format isort \ No newline at end of file diff --git a/docker/ubuntu_22_04_base b/docker/ubuntu_22_04_base index 9c3b0cb912bbdf5ca2384741d5ddbf02def7aa2b..4c62b2c0180681a05459dc8df385f0620678cfba 100644 --- a/docker/ubuntu_22_04_base +++ b/docker/ubuntu_22_04_base @@ -18,4 +18,4 @@ RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && apt-get upgrade - && ln -sf clang-tidy-12 /usr/bin/clang-tidy \ # 20220624: The latest GCOVR (5.1) is broken, so use 5.0. # jinja2<3.1 is required for the html details of GCOVR 5.0 - && python3 -m pip install gcovr==5.0 'jinja2<3.1' black cmake-format \ No newline at end of file + && python3 -m pip install gcovr==5.0 'jinja2<3.1' black cmake-format isort \ No newline at end of file diff --git a/include/schaapcommon/facets/ds9facetfile.h b/include/schaapcommon/facets/ds9facetfile.h index c0901facc71d3a228d6f889f7a50850ea142b4c6..6d5270914acbc86d82ae15ab9b941e2cf99fac86 100644 --- a/include/schaapcommon/facets/ds9facetfile.h +++ b/include/schaapcommon/facets/ds9facetfile.h @@ -106,6 +106,11 @@ class DS9FacetFile { direction_label = ParseDirectionLabel(Type(), Token()); } else if (t == "point" && !coordinates.empty()) { direction = ReadPoint(); + const std::string direction_label_point = + ParseDirectionLabel(Type(), Token()); + if (direction_label_point != "") { + direction_label = direction_label_point; + } } } } diff --git a/scripts/format.sh b/scripts/format.sh index 009fed7879588177b886ce2c0314ae4ce94cbdcb..41ac7b18ff631f2dcf929f70dd8a06e22c2a3be4 100644 --- a/scripts/format.sh +++ b/scripts/format.sh @@ -78,6 +78,9 @@ PYTHON_FILES=$(git ls-files $PYTHON_FILES_EXCLUDEDIRS) # Use line length 79, which complies with PEP-8. BLACK="black -l 79" +# Sort imports according to PEP-8 +ISORT="isort --profile black" + if [[ "${CLANG_FORMAT_BINARY}" == "" ]] ; then CLANG_FORMAT_BINARY="clang-format" fi @@ -87,7 +90,8 @@ if [ -n "$DRYRUN" ]; then if !(${CLANG_FORMAT_BINARY} -style=file --output-replacements-xml $CXX_FILES | grep -q "<replacement ") && cmake-format --check $CMAKE_FILES && - $BLACK --check $PYTHON_FILES; then + $BLACK --check $PYTHON_FILES && + $ISORT --check $PYTHON_FILES; then # Print in bold-face green echo -e "\e[1m\e[32mGreat job, all files are properly formatted!\e[0m" else @@ -100,6 +104,7 @@ else ${CLANG_FORMAT_BINARY} -i -style=file $CXX_FILES cmake-format -i $CMAKE_FILES $BLACK -q $PYTHON_FILES + $ISORT -q $PYTHON_FILES # Print in bold-face echo -e "\e[1mSuccessfully formatted all files.\e[0m" fi diff --git a/src/facets/test/resources/foursources.reg b/src/facets/test/resources/foursources.reg index 3a90442a6800a6a4a0ffdbc1ddd7575c3a43ab2e..02cba0cba1d928cb6f74fef770d0a015294fe8fe 100644 --- a/src/facets/test/resources/foursources.reg +++ b/src/facets/test/resources/foursources.reg @@ -14,8 +14,10 @@ polygon(23.0,30.5, 23.0,31.5, 21.0,31.5, 21.0,30.5) # text=CygA point(23.0,31.5) # Ra@(400,256). Polygon is (364,129) (366,301) (541,305) (547,128). -polygon(23.15,31.88, 23.10,33.6, 21.0,33.6, 21.0,31.83) # text=CygAO -point(23.10,33.6) +polygon(23.15,31.88, 23.10,33.6, 21.0,33.6, 21.0,31.83) +# Text label is given after point(...) instead of after polygon(...) +# This label should be parsed as well +point(23.10,33.6) # text=CygAO # Dec@(256,64). Polygon is (128,-9) (128,128) (384,128) (384,-9). polygon(25.91,30.5, 25.93,31.87, 22.92,31.87, 22.94,30.5) # text=CygTJ