diff --git a/DataQuality/DQDefects/CMakeLists.txt b/DataQuality/DQDefects/CMakeLists.txt
index fd8bd936d562bb2c6edde0a507faa867bf4b0135..78af5128d1f22db445d1d3809339d08139d1b5d8 100644
--- a/DataQuality/DQDefects/CMakeLists.txt
+++ b/DataQuality/DQDefects/CMakeLists.txt
@@ -14,15 +14,12 @@ find_package( Oracle )
 find_package( pyyaml )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py python/tests python/data )
+atlas_install_python_modules( python/*.py python/tests python/data
+   POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select E11,E402,W1 )
+
 atlas_install_scripts( share/*.py share/*.sh )
 
 # Add tests
 atlas_add_test( DQDefects SCRIPT test/DQDefects_test.sh
                 LOG_IGNORE_PATTERN "^Ran .* tests in"
                 PROPERTIES TIMEOUT 300 )
-		
-# Code quality check
-atlas_add_test( flake8
-   SCRIPT flake8 --select=ATL,E11,E402,E71,E72,E9,W1,W6,F ${CMAKE_CURRENT_SOURCE_DIR}/python/
-   POST_EXEC_SCRIPT nopost.sh )
diff --git a/DataQuality/DQUtils/CMakeLists.txt b/DataQuality/DQUtils/CMakeLists.txt
index 611fb0d9a2fa25c90fcaacfa00e816413188f76f..5ffbd7d58b04c4c0430311f157382a8679726773 100644
--- a/DataQuality/DQUtils/CMakeLists.txt
+++ b/DataQuality/DQUtils/CMakeLists.txt
@@ -39,10 +39,7 @@ atlas_add_dictionary( DQUtilsDict
                       LINK_LIBRARIES ${ORACLE_LIBRARIES} ${Boost_LIBRARIES} ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${Python_LIBRARIES} ${CORAL_LIBRARIES} CoraCool DQUtils )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py python/ext python/sugar )
-atlas_install_scripts( share/count_filled_lbs.py share/dqu_grldiff.py share/dqu_lumi.py share/dqu_grl_extract_period.py share/dqu_dump_periods.py )
+atlas_install_python_modules( python/*.py python/ext python/sugar
+   POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select E11,E402,W1 --extend-ignore E731 )
 
-# Code quality check
-atlas_add_test( flake8
-   SCRIPT flake8 --select=ATL,E11,E402,E71,E72,E9,W1,W6,F ${CMAKE_CURRENT_SOURCE_DIR}/python/
-   POST_EXEC_SCRIPT nopost.sh )
+atlas_install_scripts( share/count_filled_lbs.py share/dqu_grldiff.py share/dqu_lumi.py share/dqu_grl_extract_period.py share/dqu_dump_periods.py )
diff --git a/DataQuality/DQUtils/python/ext/table_printer.py b/DataQuality/DQUtils/python/ext/table_printer.py
index 9b1605190453832f11d97268ac2d3e9d71216906..4fe8bfb5c5697467a9d9a7e9f96114ff83bc5a99 100644
--- a/DataQuality/DQUtils/python/ext/table_printer.py
+++ b/DataQuality/DQUtils/python/ext/table_printer.py
@@ -1,3 +1,4 @@
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 #coding: UTF8
 """
 Prints out a table, padded to make it pretty.
diff --git a/DataQuality/DataQualityUtils/CMakeLists.txt b/DataQuality/DataQualityUtils/CMakeLists.txt
index 0d9432883b47279fb499b8784d737d0612164f0a..de9d784c7824656d7f8c04d4f75f39caae5805df 100644
--- a/DataQuality/DataQualityUtils/CMakeLists.txt
+++ b/DataQuality/DataQualityUtils/CMakeLists.txt
@@ -80,7 +80,9 @@ atlas_add_executable( han-results-print
                       LINK_LIBRARIES ${Boost_LIBRARIES} ${COOL_LIBRARIES} ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} DataQualityInterfaces DataQualityUtils )
 
 # Install files from the package:
-atlas_install_python_modules( python/*.py )
+atlas_install_python_modules( python/*.py
+   POST_BUILD_CMD ${ATLAS_FLAKE8} --extend-select E11,E402,W1 --extend-ignore E731 )
+
 atlas_install_scripts( scripts/CreateDB.py scripts/CreateDB_Histo.py scripts/DQHistogramMerge.py scripts/DQHistogramPrintStatistics.py scripts/DQWebDisplay.py scripts/hancool_histo.py scripts/hancool.py scripts/handi.py scripts/DQFileMove.py scripts/CreateMDTConfig_algos.sh scripts/CreateMDTConfig_chambers.sh scripts/CreateMDTConfig_config.sh scripts/CreateMDTConfig_files.sh scripts/CreateMDTConfig_readme.sh scripts/DQM_Tier0Wrapper_trf.py scripts/DQM_Tier0Wrapper_tf.py scripts/DQHistogramMergeRegExp.py scripts/dq_make_web_display.py scripts/ScanHistFile.py scripts/physval_make_web_display.py )
 
 # Aliases:
@@ -96,8 +98,3 @@ atlas_add_alias( CreateMDTConfig_readme "CreateMDTConfig_readme.sh" )
 atlas_add_alias( DQHistogramMerge "DQHistogramMerge.py" )
 atlas_add_alias( DQWebDisplay "DQWebDisplay.py" )
 atlas_add_alias( CreateMDTConfig_chambers "CreateMDTConfig_chambers.sh" )
-
-# Code quality check
-atlas_add_test( flake8
-   SCRIPT flake8 --select=ATL,E11,E402,E71,E72,E9,W1,W6,F ${CMAKE_CURRENT_SOURCE_DIR}/python/
-   POST_EXEC_SCRIPT nopost.sh )
diff --git a/DataQuality/DataQualityUtils/python/DQGetHistogramMod.py b/DataQuality/DataQualityUtils/python/DQGetHistogramMod.py
index 6b0e2c8a752079b8068d48ebc4cac6d7f296f234..3882bb9a9fd65f8b57ffc5c3e046fb0843c08221 100644
--- a/DataQuality/DataQualityUtils/python/DQGetHistogramMod.py
+++ b/DataQuality/DataQualityUtils/python/DQGetHistogramMod.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
 
 
 # +---------------------------------------------+
@@ -36,7 +36,7 @@ def getMetadataDict(dir):
     keyNext = iter.Next()
     while keyNext:
         if keyNext.GetClassName() == "TDirectory":
-            retDict.update(getMetadataDict(keyNext.ReadObj()));
+            retDict.update(getMetadataDict(keyNext.ReadObj()))
         keyNext = iter.Next()
 
     return retDict