diff --git a/algorithms/antennaselector.cpp b/algorithms/antennaselector.cpp
index bffd50d9fd0644502cc7dc50a64037b438cd8201..21572e055186ccc0635d9b3c496f8b913d0fcf4e 100644
--- a/algorithms/antennaselector.cpp
+++ b/algorithms/antennaselector.cpp
@@ -1,5 +1,7 @@
 #include "antennaselector.h"
 
+#include <utility>
+
 #include "../quality/statisticscollection.h"
 #include "../quality/statisticsderivator.h"
 
diff --git a/algorithms/antennaselector.h b/algorithms/antennaselector.h
index 84ab0f24859df72893eeec3719377037f7f3a3f4..459f9f7c2ff0eb6d6c39531e4c8128189507eb45 100644
--- a/algorithms/antennaselector.h
+++ b/algorithms/antennaselector.h
@@ -5,6 +5,7 @@ class StatisticsCollection;
 class DefaultStatistics;
 
 #include <map>
+#include <set>
 #include <vector>
 
 namespace algorithms {
diff --git a/algorithms/applybandpass.h b/algorithms/applybandpass.h
index f853bf49ef7265fc86b3e5bd321683fb74677d7b..579bcedc0e13d00c5f5fea180427c1ffd29e4af6 100644
--- a/algorithms/applybandpass.h
+++ b/algorithms/applybandpass.h
@@ -6,6 +6,7 @@
 #include "bandpassfile.h"
 
 #include <string>
+#include <utility>
 
 namespace algorithms {
 
diff --git a/algorithms/bandpassfile.h b/algorithms/bandpassfile.h
index 64b3cfd6997b5f70e3a42cd2c5aefbee7c7bcd76..6a82215cbd682540e157004e651d4b161079e771 100644
--- a/algorithms/bandpassfile.h
+++ b/algorithms/bandpassfile.h
@@ -10,7 +10,7 @@
 
 class BandpassFile {
  public:
-  BandpassFile(const std::string& filename) {
+  explicit BandpassFile(const std::string& filename) {
     std::ifstream file(filename);
     if (!file)
       throw std::runtime_error("Can not find bandpass file: '" + filename +
@@ -49,9 +49,9 @@ class BandpassFile {
     size_t channel;
 
     bool operator<(const BandpassIndex& rhs) const {
-      if (channel < rhs.channel)
+      if (channel < rhs.channel) {
         return true;
-      else if (channel == rhs.channel) {
+      } else if (channel == rhs.channel) {
         if (polarization < rhs.polarization)
           return true;
         else if (polarization == rhs.polarization && antenna < rhs.antenna)
diff --git a/algorithms/baselineselector.cpp b/algorithms/baselineselector.cpp
index a04ab2d55f99ac5718b838d6ecb8664f2a1e36e5..c3641af9fdcebef5803f5502211065173de0b60d 100644
--- a/algorithms/baselineselector.cpp
+++ b/algorithms/baselineselector.cpp
@@ -9,6 +9,7 @@
 
 #include <algorithm>
 #include <map>
+#include <memory>
 
 namespace algorithms {
 
diff --git a/algorithms/baselinetimeplaneimager.cpp b/algorithms/baselinetimeplaneimager.cpp
index 15613f7861a0247d547be12553d400926e1830f3..9408b345f6ce556e473f2cf831fe3f8d296fdf7f 100644
--- a/algorithms/baselinetimeplaneimager.cpp
+++ b/algorithms/baselinetimeplaneimager.cpp
@@ -6,6 +6,7 @@
 
 #include <boost/iterator/iterator_concepts.hpp>
 
+#include <algorithm>
 #include <cmath>
 
 namespace algorithms {
@@ -107,9 +108,6 @@ void BaselineTimePlaneImager<NumType>::Image(
           *destPtr += fftOut[srcXIndex - fftCentre];
       }
       ++destPtr;
-      // else
-      //	output.SetValue(x, y, 0.0);
-      // if(x==0 && y==0) Logger::Debug << "srcX=" << srcX << '\n';
     }
   }
 
diff --git a/algorithms/fringestoppingfitter.cpp b/algorithms/fringestoppingfitter.cpp
index ecb6cc029a7d5d285c32525df5c71455f1a9a346..2890da4c8847052b00c37d8230d4bdc8d66c236f 100644
--- a/algorithms/fringestoppingfitter.cpp
+++ b/algorithms/fringestoppingfitter.cpp
@@ -24,9 +24,9 @@ FringeStoppingFitter::FringeStoppingFitter()
 FringeStoppingFitter::~FringeStoppingFitter() {}
 
 void FringeStoppingFitter::PerformFit(unsigned taskNumber) {
-  if (_fringeFit)
+  if (_fringeFit) {
     PerformDynamicFrequencyFitOnOneChannel(taskNumber, _maxWindowSize);
-  else {
+  } else {
     const size_t x = taskNumber;
 
     if (_fitChannelsIndividually) {
@@ -140,9 +140,9 @@ void FringeStoppingFitter::CalculateFitValue(const Image2D& real,
 
   size_t xLeft, xRight;
   xRight = x + windowWidth / 2;
-  if (x >= (windowWidth / 2))
+  if (x >= (windowWidth / 2)) {
     xLeft = x - (windowWidth / 2);
-  else {
+  } else {
     xLeft = 0;
     xRight += (windowWidth / 2) - x;
   }
diff --git a/algorithms/fringestoppingfitter.h b/algorithms/fringestoppingfitter.h
index 7cd043b24941425f26da67f4a967cd18b484cd8d..d1f5207e60b39ff797bb3785dcf0308b562189ae 100644
--- a/algorithms/fringestoppingfitter.h
+++ b/algorithms/fringestoppingfitter.h
@@ -23,7 +23,7 @@ class FringeStoppingFitter final : public SurfaceFitMethod {
     _antenna2Info = &metaData->Antenna2();
     _observationTimes = &metaData->ObservationTimes();
   }
-  virtual void Initialize(const TimeFrequencyData& input) final override {
+  void Initialize(const TimeFrequencyData& input) override {
     _originalData = &input;
     _realBackground = Image2D::CreateZeroImagePtr(_originalData->ImageWidth(),
                                                   _originalData->ImageHeight());
@@ -35,7 +35,7 @@ class FringeStoppingFitter final : public SurfaceFitMethod {
     return _fringeFit ? _originalData->ImageHeight()
                       : _originalData->ImageWidth();
   }
-  virtual void PerformFit(unsigned taskNumber) final override;
+  void PerformFit(unsigned taskNumber) override;
   void PerformStaticFrequencyFitOnOneChannel(unsigned y);
   void PerformFringeStop();
   class TimeFrequencyData Background() const {
diff --git a/algorithms/localfitmethod.cpp b/algorithms/localfitmethod.cpp
index 9c44f85e5619692e77fc6eda90ae51965756b318..1cacc4a1835352d0279dec276fe4be062e12ebe6 100644
--- a/algorithms/localfitmethod.cpp
+++ b/algorithms/localfitmethod.cpp
@@ -9,6 +9,7 @@
 
 #include <cmath>
 #include <iostream>
+#include <vector>
 
 namespace algorithms {
 
@@ -201,9 +202,9 @@ long double LocalFitMethod::CalculateWeightedAverage(unsigned x, unsigned y,
       }
     }
   }
-  if (totalWeight != 0.0)
+  if (totalWeight != 0.0) {
     return sum / totalWeight;
-  else {
+  } else {
     sum = 0.0;
     totalWeight = 0.0;
     for (unsigned j = local.startY; j <= local.endY; ++j) {
@@ -216,9 +217,9 @@ long double LocalFitMethod::CalculateWeightedAverage(unsigned x, unsigned y,
         }
       }
     }
-    if (totalWeight != 0.0)
+    if (totalWeight != 0.0) {
       return sum / totalWeight;
-    else {
+    } else {
       sum = 0.0;
       totalWeight = 0.0;
       for (unsigned j = local.startY; j <= local.endY; ++j) {
diff --git a/algorithms/medianwindow.h b/algorithms/medianwindow.h
index fa1ef56fc1ab57b3d921c88bc5135bead622240a..6f69b77f029b6103044b0c60613277357c6aa454 100644
--- a/algorithms/medianwindow.h
+++ b/algorithms/medianwindow.h
@@ -2,6 +2,7 @@
 #define MEDIANWINDOW_H
 
 #include <algorithm>
+#include <limits>
 #include <vector>
 
 #include "../structures/samplerow.h"
diff --git a/algorithms/morphologicalflagger.cpp b/algorithms/morphologicalflagger.cpp
index 74daa3fc9d37fb39398d0cc62ef000e798d066a8..ff25764b041d148e186b2be1092578112e16dc6f 100644
--- a/algorithms/morphologicalflagger.cpp
+++ b/algorithms/morphologicalflagger.cpp
@@ -1,5 +1,7 @@
 #include "morphologicalflagger.h"
 
+#include <utility>
+
 namespace algorithms {
 
 bool MorphologicalFlagger::SquareContainsFlag(const Mask2D* mask, size_t xLeft,
diff --git a/algorithms/noisestatistics.h b/algorithms/noisestatistics.h
index bd75b2c660b98c6291eeb9dcae9aefb9bda1d763..4691d75358969ec4e458fb231a71300a3cb7694f 100644
--- a/algorithms/noisestatistics.h
+++ b/algorithms/noisestatistics.h
@@ -78,9 +78,9 @@ class NoiseStatistics {
   stat_t StdDevEstimator() const { return std::sqrt(VarianceEstimator()); }
 
   stat_t VarianceEstimator() const {
-    if (_count <= 1)
+    if (_count <= 1) {
       return 0.0;
-    else {
+    } else {
       const stat_t n = _count;
       const stat_t sumMeanSquared = (_sum * _sum) / n;
       return (_sum2 + sumMeanSquared - (_sum * 2.0 * _sum / n)) / (n - 1.0);
@@ -88,9 +88,9 @@ class NoiseStatistics {
   }
 
   stat_t SecondMoment() const {
-    if (_count == 0)
+    if (_count == 0) {
       return 0.0;
-    else {
+    } else {
       const stat_t n = _count;
       const stat_t sumMeanSquared = (_sum * _sum) / n;
       return (_sum2 + sumMeanSquared - (_sum * 2.0 * _sum / n)) / n;
@@ -98,9 +98,9 @@ class NoiseStatistics {
   }
 
   stat_t FourthMoment() const {
-    if (_count == 0)
+    if (_count == 0) {
       return 0.0;
-    else {
+    } else {
       const stat_t n = _count, mean = _sum / n, mean2 = mean * mean;
       return (_sum4 - 4.0 * (_sum3 * mean + _sum * mean2 * mean) +
               6.0 * _sum2 * mean2) /
@@ -111,9 +111,9 @@ class NoiseStatistics {
 
   stat_t VarianceOfVarianceEstimator() const {
     const long double n = _count;
-    if (n <= 1)
+    if (n <= 1) {
       return 0.0;
-    else {
+    } else {
       const long double moment2 = SecondMoment();
       return (FourthMoment() - moment2 * moment2 * (n - 3.0) / (n - 1.0)) / n;
     }
diff --git a/algorithms/resampling.h b/algorithms/resampling.h
index b9b7f93901c9bac18f6e51d29f94ea0f9d4516d9..5e316aa926eb8e4785817bebb79f4a040e8e37ca 100644
--- a/algorithms/resampling.h
+++ b/algorithms/resampling.h
@@ -1,6 +1,10 @@
 #ifndef AOFLAGGER_ALGORITHMS_RESAMPLING_H
 #define AOFLAGGER_ALGORITHMS_RESAMPLING_H
 
+#include <algorithm>
+#include <utility>
+#include <vector>
+
 #include "../structures/timefrequencydata.h"
 #include "../structures/timefrequencymetadata.h"
 
diff --git a/algorithms/restorechannelrange.h b/algorithms/restorechannelrange.h
index bfa2355e3ce97eacffa7eeec6ea38a87b416b06a..6521787a44d03b9ce843efe6262c970514379bea 100644
--- a/algorithms/restorechannelrange.h
+++ b/algorithms/restorechannelrange.h
@@ -1,6 +1,9 @@
 #ifndef RESTORE_CHANNEL_RANGE_H
 #define RESTORE_CHANNEL_RANGE_H
 
+#include <utility>
+#include <vector>
+
 #include "../structures/timefrequencydata.h"
 #include "../structures/timefrequencymetadata.h"
 
diff --git a/algorithms/siroperator.h b/algorithms/siroperator.h
index d71345538212d8fd5e4e92bb83abcb9e9dde9f46..f980a8c507c6689897a6a0b137add40d94970837 100644
--- a/algorithms/siroperator.h
+++ b/algorithms/siroperator.h
@@ -1,6 +1,8 @@
 #ifndef SIROPERATOR_H
 #define SIROPERATOR_H
 
+#include <memory>
+
 #include "../structures/mask2d.h"
 #include "../structures/types.h"
 #include "../structures/xyswappedmask2d.h"
diff --git a/algorithms/sumthreshold.cpp b/algorithms/sumthreshold.cpp
index 46de1eef7e1612ee7056e8f0c5d8a3c8a7c69bfa..e0d86c4b8d821f7918be1e28205f4d712388153c 100644
--- a/algorithms/sumthreshold.cpp
+++ b/algorithms/sumthreshold.cpp
@@ -12,6 +12,8 @@
 #include <xmmintrin.h>
 #include <emmintrin.h>
 
+#include <utility>
+
 #endif
 
 namespace algorithms {
@@ -848,7 +850,7 @@ __attribute__((target("avx2"))) void SumThreshold::VerticalLargeAVX(
         // if sum/count > threshold || sum/count < -threshold
         const __m256 avg8 = _mm256_div_ps(sum8, _mm256_cvtepi32_ps(count8));
         // float a[8];
-        //_mm256_storeu_ps(a, avg8);
+        // _mm256_storeu_ps(a, avg8);
         // std::cout << a[0] << '\n';
         const int flagConditions =
             _mm256_movemask_ps(_mm256_cmp_ps(avg8, threshold8Pos, _CMP_GT_OQ)) |
diff --git a/algorithms/sumthresholdmissing.cpp b/algorithms/sumthresholdmissing.cpp
index 9b274167359f5f0829f1aa82949a7a247ef9687e..2019ef7e263bbc7edeeab94ff0bca422a6d9f014 100644
--- a/algorithms/sumthresholdmissing.cpp
+++ b/algorithms/sumthresholdmissing.cpp
@@ -3,6 +3,7 @@
 #include "../structures/xyswappedmask2d.h"
 
 #include <vector>
+#include <utility>
 
 #include "sumthreshold.h"
 
diff --git a/algorithms/svdmitigater.h b/algorithms/svdmitigater.h
index 725d8df852a4c6cc738f4c4398e73203b076a67a..f03e6f3d61b37d5e884a14f9ec15b9f6b24fbdc2 100644
--- a/algorithms/svdmitigater.h
+++ b/algorithms/svdmitigater.h
@@ -19,7 +19,7 @@ class SVDMitigater final : public SurfaceFitMethod {
   SVDMitigater();
   ~SVDMitigater();
 
-  virtual void Initialize(const TimeFrequencyData& data) final override {
+  void Initialize(const TimeFrequencyData& data) override {
     Clear();
     _data = data;
     _iteration = 0;
@@ -28,7 +28,7 @@ class SVDMitigater final : public SurfaceFitMethod {
     _iteration++;
     RemoveSingularValues(_removeCount);
   }
-  virtual void PerformFit(unsigned) final override { PerformFit(); }
+  void PerformFit(unsigned) override { PerformFit(); }
 
   void RemoveSingularValues(unsigned singularValueCount) {
     if (!IsDecomposed()) Decompose();
diff --git a/algorithms/testsetgenerator.cpp b/algorithms/testsetgenerator.cpp
index e1490dab9c43de69fe9f30d5971b40204b903b16..4651e92698316fffe1e8b8e842e425b4dc634f2a 100644
--- a/algorithms/testsetgenerator.cpp
+++ b/algorithms/testsetgenerator.cpp
@@ -2,6 +2,7 @@
 
 #include <cmath>
 #include <vector>
+#include <utility>
 
 #include "../structures/image2d.h"
 #include "../msio/pngfile.h"
diff --git a/algorithms/testsetgenerator.h b/algorithms/testsetgenerator.h
index bd8e73887101713f1a0bfb28d30aa37026ae3033..ee202a35d5cfd8afe112c8a9d56ca5a90e40e565 100644
--- a/algorithms/testsetgenerator.h
+++ b/algorithms/testsetgenerator.h
@@ -4,6 +4,7 @@
 #include <cstddef>
 #include <fstream>
 #include <random>
+#include <string>
 
 #include "../structures/image2d.h"
 #include "../structures/mask2d.h"
diff --git a/algorithms/thresholdconfig.cpp b/algorithms/thresholdconfig.cpp
index 491668da5939e0324581a7463a1becf22655bdc8..24b7a8f682f8435ea8252fba5bc4d4bb0d16f8e2 100644
--- a/algorithms/thresholdconfig.cpp
+++ b/algorithms/thresholdconfig.cpp
@@ -1,7 +1,8 @@
 #include "thresholdconfig.h"
 
+#include <algorithm>
+#include <cmath>
 #include <iostream>
-#include <math.h>
 
 #include "../structures/image2d.h"
 
diff --git a/algorithms/thresholdtools.cpp b/algorithms/thresholdtools.cpp
index 7ee69289363aa9bb989bece6edc88d0ee4031d3d..95ad951fdcb628041afbb2a4e468bd1f75c6503a 100644
--- a/algorithms/thresholdtools.cpp
+++ b/algorithms/thresholdtools.cpp
@@ -1,6 +1,7 @@
 #include <algorithm>
 #include <deque>
 #include <limits>
+#include <memory>
 
 #include <boost/numeric/conversion/bounds.hpp>
 
diff --git a/aoluarunner/baselineiterator.h b/aoluarunner/baselineiterator.h
index 00c234dcdf08dac0ba182b5346bc4842804fbdf1..9dd2582d9088d1e35efff049ce36b01bf21cf77a 100644
--- a/aoluarunner/baselineiterator.h
+++ b/aoluarunner/baselineiterator.h
@@ -50,9 +50,9 @@ class BaselineIterator {
            !_finishedBaselines)
       _dataAvailable.wait(lock);
     if ((_finishedBaselines && _baselineBuffer.size() == 0) ||
-        _exceptionOccured)
+        _exceptionOccured) {
       return nullptr;
-    else {
+    } else {
       std::unique_ptr<imagesets::BaselineData> next =
           std::move(_baselineBuffer.top());
       _baselineBuffer.pop();
diff --git a/aoluarunner/runner.cpp b/aoluarunner/runner.cpp
index 184f0d602b2e6f15e101786f5b18295190af5bc3..33568d432ebaa56d030ada80a83d731d6489c08c 100644
--- a/aoluarunner/runner.cpp
+++ b/aoluarunner/runner.cpp
@@ -25,7 +25,10 @@
 #include <algorithm>
 #include <fstream>
 
-using namespace imagesets;
+using imagesets::H5ImageSet;
+using imagesets::ImageSet;
+using imagesets::JoinedSPWSet;
+using imagesets::MSImageSet;
 
 // The order of initialization:
 // 1. If Lua strategy given, load Lua strategy
@@ -200,10 +203,10 @@ std::unique_ptr<ImageSet> Runner::initializeImageSet(const Options& options,
         fileOptions.nIntervals = 1;
       }
     }
-    if (fileOptions.nIntervals == 1)
+    if (fileOptions.nIntervals == 1) {
       msImageSet->SetInterval(fileOptions.intervalStart,
                               fileOptions.intervalEnd);
-    else {
+    } else {
       const size_t nTimes =
           fileOptions.resolvedIntEnd - fileOptions.resolvedIntStart;
       size_t start = fileOptions.resolvedIntStart + fileOptions.intervalIndex *
@@ -386,11 +389,9 @@ void Runner::writeHistory(const Options& options, const std::string& filename) {
   Logger::Debug << "Adding strategy to history table of MS...\n";
   try {
     std::string strategyFilename;
-    if (options.strategyFilename.empty())
-      /// TODO
-      ;
-    else
+    if (!options.strategyFilename.empty()) {
       strategyFilename = options.strategyFilename;
+    }
     // std::ifstream strategyFile(strategyFilename);
     // std::string content((std::istreambuf_iterator<char>(strategyFile)),
     // (std::istreambuf_iterator<char>()) );
diff --git a/aoluarunner/runner.h b/aoluarunner/runner.h
index 2ee4081356afee5ce13abbc2b34deaff2035faf7..484c825487bc7e92ede4958c2b5364faf76acf56 100644
--- a/aoluarunner/runner.h
+++ b/aoluarunner/runner.h
@@ -11,7 +11,8 @@ struct ChunkInfo;
 
 class Runner {
  public:
-  Runner(const Options& cmdLineOptions) : _cmdLineOptions(cmdLineOptions) {}
+  explicit Runner(const Options& cmdLineOptions)
+      : _cmdLineOptions(cmdLineOptions) {}
 
   void Run();
 
diff --git a/aoqplot/aoqplotwindow.h b/aoqplot/aoqplotwindow.h
index fca844193eb34b6f04c388c8474af8d71da703c0..379bd39ef9fc96f60fe969676b61588cd5829c09 100644
--- a/aoqplot/aoqplotwindow.h
+++ b/aoqplot/aoqplotwindow.h
@@ -23,7 +23,7 @@
 
 class AOQPlotWindow : public Gtk::Window {
  public:
-  AOQPlotWindow(class AOQPlotController* controller);
+  explicit AOQPlotWindow(class AOQPlotController* controller);
 
   void Open(const std::vector<std::string>& files);
   void Open(const std::string& file) {
diff --git a/aoqplot/baselineplotpage.h b/aoqplot/baselineplotpage.h
index ec2edb9ecf63199bfb19f362155eac4331bb9a5a..8858807d0a92bda6950c6359fc6377ac05a44cef 100644
--- a/aoqplot/baselineplotpage.h
+++ b/aoqplot/baselineplotpage.h
@@ -12,7 +12,7 @@
 
 class BaselinePlotPage : public GrayScalePlotPage {
  public:
-  BaselinePlotPage(class BaselinePageController* controller);
+  explicit BaselinePlotPage(class BaselinePageController* controller);
   virtual ~BaselinePlotPage();
 
  protected:
diff --git a/aoqplot/blengthplotpage.h b/aoqplot/blengthplotpage.h
index 50a22f3300bb06b93b251fdd0ec829411eaee765..94931b3dcc121a5c138a008163e79dd2c0155766 100644
--- a/aoqplot/blengthplotpage.h
+++ b/aoqplot/blengthplotpage.h
@@ -9,7 +9,7 @@
 
 class BLengthPlotPage : public TwoDimensionalPlotPage {
  public:
-  BLengthPlotPage(BLengthPageController* controller)
+  explicit BLengthPlotPage(BLengthPageController* controller)
       : TwoDimensionalPlotPage(controller),
         _controller(controller),
         _includeAutoCorrelationsButton("Auto-correlations") {}
diff --git a/aoqplot/datawindow.cpp b/aoqplot/datawindow.cpp
index 9ffae0d998510b7fb9831634b2775effc736f763..481c56fc7dcf9bd00600bca95988b288fe86f6fd 100644
--- a/aoqplot/datawindow.cpp
+++ b/aoqplot/datawindow.cpp
@@ -42,8 +42,9 @@ void DataWindow::loadData(size_t plotSetIndex) {
       if (_plot->XAxis().Type() == AxisType::kText) {
         const std::string& label = _plot->XAxis().TickLabels()[i].second;
         _dataStream << i << '\t' << label << '\t' << y << '\n';
-      } else
+      } else {
         _dataStream << i << '\t' << x << '\t' << y << '\n';
+      }
     }
   }
   SetData(_dataStream.str());
diff --git a/aoqplot/frequencyplotpage.h b/aoqplot/frequencyplotpage.h
index 952cf6ff518b6151902e61c2891bd0eebfa722aa..901ad6f8626d540b08780e13771a22ffadcf2f83 100644
--- a/aoqplot/frequencyplotpage.h
+++ b/aoqplot/frequencyplotpage.h
@@ -10,7 +10,7 @@
 
 class FrequencyPlotPage : public TwoDimensionalPlotPage {
  public:
-  FrequencyPlotPage(FrequencyPageController* controller)
+  explicit FrequencyPlotPage(FrequencyPageController* controller)
       : TwoDimensionalPlotPage(controller),
         _controller(controller),
         _ftButton("FT") {}
diff --git a/aoqplot/grayscaleplotpage.h b/aoqplot/grayscaleplotpage.h
index 66d0ab45e18862a9e5c4e6f7bcc49a881bde6d0d..630708ea4330797645c8ed7c0d4d76a780d0a12f 100644
--- a/aoqplot/grayscaleplotpage.h
+++ b/aoqplot/grayscaleplotpage.h
@@ -15,11 +15,9 @@
 
 #include "plotsheet.h"
 
-using namespace aocommon;
-
 class GrayScalePlotPage : public PlotSheet {
  public:
-  GrayScalePlotPage(class HeatMapPageController* controller);
+  explicit GrayScalePlotPage(class HeatMapPageController* controller);
   virtual ~GrayScalePlotPage();
 
   virtual void InitializeToolbar(Gtk::Toolbar& toolbar) override final;
@@ -44,7 +42,7 @@ class GrayScalePlotPage : public PlotSheet {
   void initPhaseButtons(Gtk::Toolbar& toolbar);
   void initPlotOptions(Gtk::Toolbar& toolbar);
 
-  PolarizationEnum getSelectedPolarization() const;
+  aocommon::PolarizationEnum getSelectedPolarization() const;
   enum TimeFrequencyData::ComplexRepresentation getSelectedPhase() const;
 
   void onSelectCount() {
diff --git a/aoqplot/histogrampage.h b/aoqplot/histogrampage.h
index d3f133bfb7300606bb7b8eb391a35bbd06c96407..fb632bac8f87ff171e0b80956454dd9ffd646d6e 100644
--- a/aoqplot/histogrampage.h
+++ b/aoqplot/histogrampage.h
@@ -18,7 +18,7 @@
 
 class HistogramPage : public PlotSheet {
  public:
-  HistogramPage(class HistogramPageController* controller);
+  explicit HistogramPage(class HistogramPageController* controller);
   ~HistogramPage();
 
   void updatePlot();
diff --git a/aoqplot/summarypage.h b/aoqplot/summarypage.h
index 78f99b9d72ff580d8a4fc18a53491d75c1aace81..5c3bdf31e6d0633a9bd2acdeb3b7dee99adbcf27 100644
--- a/aoqplot/summarypage.h
+++ b/aoqplot/summarypage.h
@@ -124,7 +124,8 @@ class SummaryPageController : public AOQPageController {
 
 class SummaryPage : public PlotSheet {
  public:
-  SummaryPage(SummaryPageController* controller) : _controller(controller) {
+  explicit SummaryPage(SummaryPageController* controller)
+      : _controller(controller) {
     add(_textView);
     _textView.show();
 
diff --git a/aoqplot/timefrequencyplotpage.h b/aoqplot/timefrequencyplotpage.h
index d2513bd77e3c992b6222ed248c3617f0fdc23ea2..7231f73d2d5eec243f6fefc5fbd055b23fe46ca8 100644
--- a/aoqplot/timefrequencyplotpage.h
+++ b/aoqplot/timefrequencyplotpage.h
@@ -5,7 +5,7 @@
 
 class TimeFrequencyPlotPage : public GrayScalePlotPage {
  public:
-  TimeFrequencyPlotPage(class TFPageController* controller);
+  explicit TimeFrequencyPlotPage(class TFPageController* controller);
 
  private:
   void onMouseMoved(double x, double y);
diff --git a/aoqplot/twodimensionalplotpage.h b/aoqplot/twodimensionalplotpage.h
index c4155761dd50a9b36651ddd04b1571acd2428b3b..c716a455970022af130d473e2b7c7ae82905ae4d 100644
--- a/aoqplot/twodimensionalplotpage.h
+++ b/aoqplot/twodimensionalplotpage.h
@@ -19,7 +19,7 @@
 
 class TwoDimensionalPlotPage : public PlotSheet {
  public:
-  TwoDimensionalPlotPage(AOQPlotPageController* _controller);
+  explicit TwoDimensionalPlotPage(AOQPlotPageController* _controller);
   virtual ~TwoDimensionalPlotPage();
 
   virtual void InitializeToolbar(Gtk::Toolbar& toolbar) override final;
diff --git a/applications/aoflagger.cpp b/applications/aoflagger.cpp
index dc1fdbdd4340c22ac91ec1628e972b5c42a9c80b..6e754a249df00e4f29dd1a6c7c432edd4f202ddb 100644
--- a/applications/aoflagger.cpp
+++ b/applications/aoflagger.cpp
@@ -170,13 +170,13 @@ formats and some more. See the documentation for support of other file types.
     } else if (flag == "baselines") {
       ++parameterIndex;
       const std::string bTypes = argv[parameterIndex];
-      if (bTypes == "all")
+      if (bTypes == "all") {
         options.baselineSelection = BaselineSelection::All;
-      else if (bTypes == "cross")
+      } else if (bTypes == "cross") {
         options.baselineSelection = BaselineSelection::CrossCorrelations;
-      else if (bTypes == "auto")
+      } else if (bTypes == "auto") {
         options.baselineSelection = BaselineSelection::AutoCorrelations;
-      else {
+      } else {
         Logger::Error << "Incorrect usage; baselines parameter should be set "
                          "to 'all', 'cross' or 'auto'.\n";
         return RETURN_CMDLINE_ERROR;
diff --git a/applications/aoqplot.cpp b/applications/aoqplot.cpp
index 7a06f72553e9828692ce025a872f461f35287404..a08c8f90230fd5b038ed52375ba6e305d77bca48 100644
--- a/applications/aoqplot.cpp
+++ b/applications/aoqplot.cpp
@@ -29,8 +29,9 @@ bool SelectFile(AOQPlotWindow& window, std::string& filename) {
   if (fileDialog.run() == Gtk::RESPONSE_OK) {
     filename = fileDialog.get_filename();
     return true;
-  } else
+  } else {
     return false;
+  }
 }
 
 int main(int argc, char* argv[]) {
diff --git a/applications/aoquality.cpp b/applications/aoquality.cpp
index 3a33a8d70e9a0c503d8e7fdccac8f8de09fc9ae2..fb0e50abf4990670c927c69e8a6790907cbf28d2 100644
--- a/applications/aoquality.cpp
+++ b/applications/aoquality.cpp
@@ -157,20 +157,21 @@ int main(int argc, char* argv[]) {
         size_t intervalStart = 0, intervalEnd = 0;
         while (argi < argc && argv[argi][0] == '-') {
           const std::string p = &argv[argi][1];
-          if (p == "h")
+          if (p == "h") {
             histograms = true;
-          else if (p == "d") {
+          } else if (p == "d") {
             ++argi;
             dataColumnName = argv[argi];
-          } else if (p == "tf")
+          } else if (p == "tf") {
             timeFrequency = true;
-          else if (p == "interval") {
+          } else if (p == "interval") {
             intervalStart = atoi(argv[argi + 1]);
             intervalEnd = atoi(argv[argi + 2]);
             argi += 2;
-          } else
+          } else {
             throw std::runtime_error(
                 "Bad parameter given to aoquality collect");
+          }
           ++argi;
         }
         const std::string filename = argv[argi];
@@ -272,8 +273,9 @@ int main(int argc, char* argv[]) {
           if (p == "downsample") {
             ++argi;
             downsample = std::atoi(argv[argi]);
-          } else
+          } else {
             throw std::runtime_error("Invalid parameter: " + p);
+          }
           ++argi;
         }
         quality::PrintPerFrequencyStatistics(
@@ -283,19 +285,19 @@ int main(int argc, char* argv[]) {
     } else if (action == "query_fr") {
       if (argc == 5) {
         const std::string range = argv[4];
-        if (range == "DVB4")
+        if (range == "DVB4") {
           quality::PrintFrequencyRangeStatistic(
               argv[2], AsVector(argv, 3, argc), 167, 174);
-        else if (range == "DVB5")
+        } else if (range == "DVB5") {
           quality::PrintFrequencyRangeStatistic(
               argv[2], AsVector(argv, 3, argc), 174, 181);
-        else if (range == "DVB6")
+        } else if (range == "DVB6") {
           quality::PrintFrequencyRangeStatistic(
               argv[2], AsVector(argv, 3, argc), 181, 188);
-        else if (range == "DVB7")
+        } else if (range == "DVB7") {
           quality::PrintFrequencyRangeStatistic(
               argv[2], AsVector(argv, 3, argc), 188, 195);
-        else {
+        } else {
           std::cerr << "Syntax for query times: 'aoquality query_fr <KIND> "
                        "<MS> <START MHZ> <END MHZ>'\n";
           return -1;
diff --git a/applications/badstations.cpp b/applications/badstations.cpp
index f8d7dffcb1eb2359626232e45d5f10b7e245d19d..9c0f1ed4ad79e80ef16307adec75e3a2bb9ec674 100644
--- a/applications/badstations.cpp
+++ b/applications/badstations.cpp
@@ -170,9 +170,9 @@ int main(int argc, char* argv[]) {
   enum Method { StddevMethod, RFIPercentangeMethod } method = StddevMethod;
   while (argi < argc && argv[argi][0] == '-') {
     const std::string p(argv[argi] + 1);
-    if (p == "flag")
+    if (p == "flag") {
       doFlag = true;
-    else if (p == "method") {
+    } else if (p == "method") {
       ++argi;
       const std::string m = argv[argi];
       if (m == "stddev")
@@ -181,8 +181,9 @@ int main(int argc, char* argv[]) {
         method = RFIPercentangeMethod;
       else
         throw std::runtime_error("Unknown method given");
-    } else
+    } else {
       throw std::runtime_error("Unknown parameter");
+    }
     ++argi;
   }
   if (argi >= argc) {
diff --git a/applications/rfigui.cpp b/applications/rfigui.cpp
index bb564b614207ed7c1adc3f22692bbc941f793a93..661a4766ba088367c4f7c3d04006e0d357fd997b 100644
--- a/applications/rfigui.cpp
+++ b/applications/rfigui.cpp
@@ -132,9 +132,9 @@ static void run(int argc, char* argv[]) {
 
   try {
     if (!filenames.empty()) {
-      if (interactive)
+      if (interactive) {
         window->OpenPaths(filenames);
-      else {
+      } else {
         Pango::init();
         MSOptions options;
         options.ioMode = DirectReadMode;
diff --git a/imagesets/imageset.cpp b/imagesets/imageset.cpp
index 1eae9bf644ef53c15b7c0e9cec934de04e7a90a5..0b43fcb5d798af97986c3117189add4505048f25 100644
--- a/imagesets/imageset.cpp
+++ b/imagesets/imageset.cpp
@@ -22,31 +22,31 @@ std::unique_ptr<ImageSet> ImageSet::Create(
   using P = std::unique_ptr<ImageSet>;
   if (files.size() == 1) {
     const std::string& file = files.front();
-    if (IsFitsFile(file))
+    if (IsFitsFile(file)) {
       return P(new FitsImageSet(file));
-    else if (IsBHFitsFile(file))
+    } else if (IsBHFitsFile(file)) {
       return P(new BHFitsImageSet(file));
-    else if (IsH5File(file))
+    } else if (IsH5File(file)) {
       return P(new H5ImageSet(file));
-    else if (IsRCPRawFile(file))
+    } else if (IsRCPRawFile(file)) {
       throw std::runtime_error("Don't know how to open RCP raw files");
-    else if (IsTKPRawFile(file))
+    } else if (IsTKPRawFile(file)) {
       throw std::runtime_error("Don't know how to open TKP raw files");
-    else if (IsRawDescFile(file))
+    } else if (IsRawDescFile(file)) {
       throw std::runtime_error("Don't know how to open RCP desc files");
-    else if (IsParmFile(file))
+    } else if (IsParmFile(file)) {
       return P(new ParmImageSet(file));
-    else if (IsPngFile(file))
+    } else if (IsPngFile(file)) {
       return P(new PngReader(file));
-    else if (IsFilterBankFile(file))
+    } else if (IsFilterBankFile(file)) {
       return P(new FilterBankSet(file));
-    else if (IsQualityStatSet(file))
+    } else if (IsQualityStatSet(file)) {
       return P(new QualityStatImageSet(file));
-    else if (IsRFIBaselineSet(file))
+    } else if (IsRFIBaselineSet(file)) {
       return P(new RFIBaselineSet(file));
-    else if (IsSdhdfFile(file))
+    } else if (IsSdhdfFile(file)) {
       return P(new SdhdfImageSet(file));
-    else {  // it's an MS
+    } else {  // it's an MS
       if (options.baselineIntegration.enable.value_or(false))
         return P(new MSStatSet(
             file, options.dataColumnName,
diff --git a/imagesets/imagesetindex.h b/imagesets/imagesetindex.h
index 1380fe933a6957fd6440b755b4594130b75e91d7..4b207b86ca94b6009ac77b07aa016d47469a20cc 100644
--- a/imagesets/imagesetindex.h
+++ b/imagesets/imagesetindex.h
@@ -18,8 +18,9 @@ class ImageSetIndex final {
     if (_value == 0) {
       _value = _n - 1;
       _hasWrapped = true;
-    } else
+    } else {
       --_value;
+    }
   }
 
   bool Empty() const { return _n == 0; }
diff --git a/imagesets/indexableset.cpp b/imagesets/indexableset.cpp
index 5743777365343f9d7b8d47da8b76dff621177023..e696d59652dec5828f9d9d388876671847ebff89 100644
--- a/imagesets/indexableset.cpp
+++ b/imagesets/indexableset.cpp
@@ -77,9 +77,9 @@ bool IndexableSet::FindMedianBaseline(imagesets::ImageSet* imageSet,
       loopIndex.Next();
     }
     const size_t n = distances.size();
-    if (n == 0)
+    if (n == 0) {
       return false;
-    else {
+    } else {
       std::nth_element(
           distances.begin(), distances.begin() + n / 2, distances.end(),
           [](const std::pair<double, imagesets::ImageSetIndex>& l,
diff --git a/imagesets/msimageset.cpp b/imagesets/msimageset.cpp
index 3ad36220e54a880ef0b9215ea06699f836197a59..868d9f7ca20ed38c8071fbfa0137564d68571f5d 100644
--- a/imagesets/msimageset.cpp
+++ b/imagesets/msimageset.cpp
@@ -184,18 +184,19 @@ void MSImageSet::AddWriteFlagsTask(const ImageSetIndex& index,
   const size_t s = _sequences[seqIndex].sequenceId;
 
   std::vector<Mask2DCPtr> allFlags;
-  if (flags.size() > _reader->Polarizations().size())
+  if (flags.size() > _reader->Polarizations().size()) {
     throw std::runtime_error(
         "Trying to write more polarizations to image set than available");
-  else if (flags.size() < _reader->Polarizations().size()) {
+  } else if (flags.size() < _reader->Polarizations().size()) {
     if (flags.size() == 1)
       for (size_t i = 0; i < _reader->Polarizations().size(); ++i)
         allFlags.emplace_back(flags[0]);
     else
       throw std::runtime_error(
           "Incorrect number of polarizations in write action");
-  } else
+  } else {
     allFlags = flags;
+  }
 
   _reader->AddWriteTask(allFlags, a1, a2, b, s);
 }
diff --git a/imagesets/msimageset.h b/imagesets/msimageset.h
index 5a6d60a581dc54beb6bcda92bebb348f5ee8e36e..3429991225ec02d5430a0933ce40a48944c59e34 100644
--- a/imagesets/msimageset.h
+++ b/imagesets/msimageset.h
@@ -147,7 +147,7 @@ class MSImageSet final : public IndexableSet {
         _readUVW(false),
         _ioMode(AutoReadMode) {}
   void initReader();
-  const static size_t not_found = std::numeric_limits<size_t>::max();
+  static const size_t not_found = std::numeric_limits<size_t>::max();
   size_t findBaselineIndex(size_t antenna1, size_t antenna2, size_t band,
                            size_t sequenceId) const;
 
diff --git a/imagesets/multibandmsimageset.h b/imagesets/multibandmsimageset.h
index 06c7f4197d894fab0d853d6eddb907ac6354028a..443ba57d63fe64b32314370f4029a3618218c484 100644
--- a/imagesets/multibandmsimageset.h
+++ b/imagesets/multibandmsimageset.h
@@ -133,7 +133,7 @@ class MultiBandMsImageSet final : public IndexableSet {
   void ProcessMetaData();
   std::unique_ptr<BaselineData> CombineData(const ImageSetIndex& index);
 
-  const static size_t kNotFound;
+  static const size_t kNotFound;
   std::vector<std::string> ms_names_;
 
   // TODO Other readers use a vector and call pop_front, if the vector contains
diff --git a/imagesets/rfibaselineset.cpp b/imagesets/rfibaselineset.cpp
index e9fff19be9eaec5f4a3088e348955a5d348c84b1..d82526d21ee2fa221879b53bebd989f18669f635 100644
--- a/imagesets/rfibaselineset.cpp
+++ b/imagesets/rfibaselineset.cpp
@@ -36,8 +36,9 @@ std::string RFIBaselineSet::BaselineDescription() {
             << " x " << _metaData.Antenna2().station << ' '
             << _metaData.Antenna2().name;
     return sstream.str();
-  } else
+  } else {
     return Files().front();
+  }
 }
 
 void RFIBaselineSet::Write(const std::vector<Mask2DCPtr>& masks) {
diff --git a/imagesets/sdhdfimageset.cpp b/imagesets/sdhdfimageset.cpp
index fc617949b8bc9ba4a8a5014a280ffb49082a766e..061111ab8be756c2a69ffe92d27ddb8dab18050d 100644
--- a/imagesets/sdhdfimageset.cpp
+++ b/imagesets/sdhdfimageset.cpp
@@ -91,8 +91,9 @@ bool SdhdfImageSet::tryOpen(H5::DataSet& dataSet, H5::H5File& file,
   if (file.exists(name)) {
     dataSet = file.openDataSet(name);
     return true;
-  } else
+  } else {
     return false;
+  }
 #else
   // file.exists(name) doesn't work in older HDF5 libs, so use trial
   // and error. Unfortunately this generates output on the cmdline
diff --git a/imaging/model.cpp b/imaging/model.cpp
index 66bba31cef6bb0b4046e40f410d00b609a496704..f4e54be41f0ca35a8acebdc1b0d334e384c6c76e 100644
--- a/imaging/model.cpp
+++ b/imaging/model.cpp
@@ -215,9 +215,9 @@ void Model::GetUVPosition(num_t& u, num_t& v, num_t earthLattitudeAngle,
       sqrtn(dxProjected * dxProjected + dyProjected * dyProjected);
 
   long double baselineAngle;
-  if (baselineLength == 0.0)
+  if (baselineLength == 0.0) {
     baselineAngle = 0.0;
-  else {
+  } else {
     baselineLength /= 299792458.0L * wavelength;
     if (dxProjected > 0.0L)
       baselineAngle = atann(dyProjected / dxProjected);
diff --git a/imaging/uvimager.cpp b/imaging/uvimager.cpp
index c0298bae12c45f9e1287955b4eca13592f3f797a..c60ff86bfb2c6eb96723f5363498f72beb3988c2 100644
--- a/imaging/uvimager.cpp
+++ b/imaging/uvimager.cpp
@@ -454,9 +454,9 @@ void UVImager::GetUVPosition(num_t& u, num_t& v,
       sqrtn(dxProjected * dxProjected + dyProjected * dyProjected);
 
   num_t baselineAngle;
-  if (baselineLength == 0.0L)
+  if (baselineLength == 0.0L) {
     baselineAngle = 0.0L;
-  else {
+  } else {
     baselineLength /= cache.wavelength;
     if (dxProjected > 0.0L)
       baselineAngle = atann(dyProjected / dxProjected);
diff --git a/interface/qualitystatistics.cpp b/interface/qualitystatistics.cpp
index a95c8458b12be749f1dceb2d07c351ce5bc1088c..9abdd201e8f9ea49c3aa47819a836d02186237ba 100644
--- a/interface/qualitystatistics.cpp
+++ b/interface/qualitystatistics.cpp
@@ -36,9 +36,9 @@ QualityStatistics& QualityStatistics::operator=(
     if (sourceQS._data != nullptr)
       _data.reset(new QualityStatisticsData(sourceQS._data->_implementation));
   } else {
-    if (sourceQS._data != nullptr)
+    if (sourceQS._data != nullptr) {
       _data->_implementation = sourceQS._data->_implementation;
-    else {
+    } else {
       _data.reset();
     }
   }
diff --git a/lua/data.h b/lua/data.h
index afc99a8ed1da32251197e2612166c07c9c579e39..82a26c3777dd76459b9707857c8dce74857e7c4d 100644
--- a/lua/data.h
+++ b/lua/data.h
@@ -20,7 +20,7 @@ class Data {
     Context& operator=(Context&&) = default;
   };
 
-  Data(Context& context) : _context(&context), _persistent(false) {
+  explicit Data(Context& context) : _context(&context), _persistent(false) {
     context.list.emplace_back(this);
   }
 
diff --git a/lua/datawrapper.cpp b/lua/datawrapper.cpp
index 252d5785da5fcff271eb98e3faa41aa692c4cc70..9da31ae39c914a80cea2408c8e7b2c5cb5a840c8 100644
--- a/lua/datawrapper.cpp
+++ b/lua/datawrapper.cpp
@@ -21,17 +21,17 @@ int Data::convert_to_complex(lua_State* L) {
   try {
     enum TimeFrequencyData::ComplexRepresentation complexRepresentation;
     // PhasePart, AmplitudePart, RealPart, ImaginaryPart, ComplexParts
-    if (reprStr == "phase")
+    if (reprStr == "phase") {
       complexRepresentation = TimeFrequencyData::PhasePart;
-    else if (reprStr == "amplitude")
+    } else if (reprStr == "amplitude") {
       complexRepresentation = TimeFrequencyData::AmplitudePart;
-    else if (reprStr == "real")
+    } else if (reprStr == "real") {
       complexRepresentation = TimeFrequencyData::RealPart;
-    else if (reprStr == "imaginary")
+    } else if (reprStr == "imaginary") {
       complexRepresentation = TimeFrequencyData::ImaginaryPart;
-    else if (reprStr == "complex")
+    } else if (reprStr == "complex") {
       complexRepresentation = TimeFrequencyData::ComplexParts;
-    else {
+    } else {
       return luaL_error(
           L,
           "Unknown complex representation specified in convert_to_complex(): "
diff --git a/lua/functions.cpp b/lua/functions.cpp
index 2394361119bd61079126d778befa6273d657fc44..faa21af084543e1fc7535050d89cb5f616fdd72e 100644
--- a/lua/functions.cpp
+++ b/lua/functions.cpp
@@ -446,9 +446,10 @@ Data trim_frequencies(const Data& data, double start_frequency,
     const std::pair<size_t, size_t> channelRange =
         data.MetaData()->Band().GetChannelRange(start_frequency, end_frequency);
     return trim_channels(data, channelRange.first, channelRange.second);
-  } else
+  } else {
     throw std::runtime_error(
         "trim_frequency(): No spectral band information available!");
+  }
 }
 
 void visualize(Data& data, const std::string& label, size_t sortingIndex,
diff --git a/lua/luathreadgroup.h b/lua/luathreadgroup.h
index 99c806e8ccead86f6d2df443f91e71202fecc1fd..51031172ddf8b2326307fc2be2b265c7a3b2505d 100644
--- a/lua/luathreadgroup.h
+++ b/lua/luathreadgroup.h
@@ -7,7 +7,7 @@
 
 class LuaThreadGroup {
  public:
-  LuaThreadGroup(size_t nThreads) : _strategies(nThreads) {}
+  explicit LuaThreadGroup(size_t nThreads) : _strategies(nThreads) {}
 
   void LoadFile(const char* filename) {
     for (LuaStrategy& s : _strategies) {
diff --git a/msio/baselinereader.cpp b/msio/baselinereader.cpp
index a525f88254002b8512e7c992123c0a501edbfe97..4b61c3a17c22dc188004dc29115be0a004b3a231 100644
--- a/msio/baselinereader.cpp
+++ b/msio/baselinereader.cpp
@@ -18,8 +18,6 @@
 
 #include "../util/logger.h"
 
-using namespace aocommon;
-
 DummyProgressListener BaselineReader::dummy_progress_;
 
 BaselineReader::BaselineReader(const std::string& msFile)
@@ -96,8 +94,8 @@ void BaselineReader::initializePolarizations() {
     const casacore::Array<int>::iterator iterend(corType.end());
     for (casacore::Array<int>::iterator iter = corType.begin(); iter != iterend;
          ++iter) {
-      const PolarizationEnum polarization =
-          Polarization::AipsIndexToEnum(*iter);
+      const aocommon::PolarizationEnum polarization =
+          aocommon::Polarization::AipsIndexToEnum(*iter);
       _polarizations.push_back(polarization);
     }
   }
diff --git a/msio/directbaselinereader.h b/msio/directbaselinereader.h
index fe75f3617f9805e13e7884748b55c904ac87b93c..0a1280d61d7059a646f9b10d0b5eaf6fdf89bcc4 100644
--- a/msio/directbaselinereader.h
+++ b/msio/directbaselinereader.h
@@ -52,12 +52,12 @@ class DirectBaselineReader final : public BaselineReader {
              sequenceId == rhs.sequenceId;
     }
     bool operator<(const BaselineCacheIndex& rhs) const {
-      if (antenna1 < rhs.antenna1)
+      if (antenna1 < rhs.antenna1) {
         return true;
-      else if (antenna1 == rhs.antenna1) {
-        if (antenna2 < rhs.antenna2)
+      } else if (antenna1 == rhs.antenna1) {
+        if (antenna2 < rhs.antenna2) {
           return true;
-        else if (antenna2 == rhs.antenna2) {
+        } else if (antenna2 == rhs.antenna2) {
           if (spectralWindow < rhs.spectralWindow)
             return true;
           else if (spectralWindow == rhs.spectralWindow)
diff --git a/msio/memorybaselinereader.cpp b/msio/memorybaselinereader.cpp
index e8ce442e090b276b845ed52eac39d9d59b71df77..337cb6cf99fcddd588acffb079988566c3c2e3a6 100644
--- a/msio/memorybaselinereader.cpp
+++ b/msio/memorybaselinereader.cpp
@@ -14,8 +14,6 @@
 
 #include <vector>
 
-using namespace casacore;
-
 void MemoryBaselineReader::PrepareReadWrite(ProgressListener& progress) {
   if (!_isRead) {
     progress.OnStartTask("Reading measurement set into memory");
@@ -44,8 +42,9 @@ void MemoryBaselineReader::PerformReadRequests(ProgressListener& progress) {
                << request.spectralWindow
                << ", sequenceId=" << request.sequenceId << ")";
       throw std::runtime_error(errorStr.str());
-    } else
+    } else {
       _results.push_back(*requestedBaselineIter->second);
+    }
   }
 
   _readRequests.clear();
@@ -59,17 +58,18 @@ void MemoryBaselineReader::readSet(ProgressListener& progress) {
 
   const casacore::MeasurementSet table(OpenMS());
 
-  ScalarColumn<int> ant1Column(
-      table, casacore::MeasurementSet::columnName(MSMainEnums::ANTENNA1)),
-      ant2Column(table,
-                 casacore::MeasurementSet::columnName(MSMainEnums::ANTENNA2)),
+  casacore::ScalarColumn<int> ant1Column(
+      table,
+      casacore::MeasurementSet::columnName(casacore::MSMainEnums::ANTENNA1)),
+      ant2Column(table, casacore::MeasurementSet::columnName(
+                            casacore::MSMainEnums::ANTENNA2)),
       dataDescIdColumn(table, casacore::MeasurementSet::columnName(
-                                  MSMainEnums::DATA_DESC_ID));
-  ArrayColumn<casacore::Complex> dataColumn(table, DataColumnName());
-  ArrayColumn<bool> flagColumn(
-      table, casacore::MeasurementSet::columnName(MSMainEnums::FLAG));
-  ArrayColumn<double> uvwColumn(
-      table, casacore::MeasurementSet::columnName(MSMainEnums::UVW));
+                                  casacore::MSMainEnums::DATA_DESC_ID));
+  casacore::ArrayColumn<casacore::Complex> dataColumn(table, DataColumnName());
+  casacore::ArrayColumn<bool> flagColumn(
+      table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::FLAG));
+  casacore::ArrayColumn<double> uvwColumn(
+      table, casacore::MeasurementSet::columnName(casacore::MSMainEnums::UVW));
 
   size_t antennaCount = MetaData().AntennaCount(),
          polarizationCount = Polarizations().size(),
@@ -141,8 +141,8 @@ void MemoryBaselineReader::readSet(ProgressListener& progress) {
     dataArray = dataColumn.get(rowIndex);
     flagArray = flagColumn.get(rowIndex);
 
-    Array<double> uvwArray = uvwColumn.get(rowIndex);
-    Array<double>::const_contiter uvwPtr = uvwArray.cbegin();
+    casacore::Array<double> uvwArray = uvwColumn.get(rowIndex);
+    casacore::Array<double>::const_contiter uvwPtr = uvwArray.cbegin();
     UVW uvw;
     uvw.u = *uvwPtr;
     ++uvwPtr;
@@ -152,8 +152,9 @@ void MemoryBaselineReader::readSet(ProgressListener& progress) {
     result->_uvw[timeIndexInSequence] = uvw;
 
     for (size_t p = 0; p != polarizationCount; ++p) {
-      Array<Complex>::const_contiter dataPtr = dataArray.cbegin();
-      Array<bool>::const_contiter flagPtr = flagArray.cbegin();
+      casacore::Array<casacore::Complex>::const_contiter dataPtr =
+          dataArray.cbegin();
+      casacore::Array<bool>::const_contiter flagPtr = flagArray.cbegin();
 
       Image2D& real = *result->_realImages[p];
       Image2D& imag = *result->_imaginaryImages[p];
@@ -226,14 +227,15 @@ void MemoryBaselineReader::PerformFlagWriteRequests() {
 void MemoryBaselineReader::WriteToMs() {
   casacore::MeasurementSet ms(OpenMS(true));
 
-  ScalarColumn<int> ant1Column(
-      ms, casacore::MeasurementSet::columnName(MSMainEnums::ANTENNA1)),
-      ant2Column(ms,
-                 casacore::MeasurementSet::columnName(MSMainEnums::ANTENNA2)),
-      dataDescIdColumn(
-          ms, casacore::MeasurementSet::columnName(MSMainEnums::DATA_DESC_ID));
-  ArrayColumn<bool> flagColumn(
-      ms, casacore::MeasurementSet::columnName(MSMainEnums::FLAG));
+  casacore::ScalarColumn<int> ant1Column(
+      ms,
+      casacore::MeasurementSet::columnName(casacore::MSMainEnums::ANTENNA1)),
+      ant2Column(ms, casacore::MeasurementSet::columnName(
+                         casacore::MSMainEnums::ANTENNA2)),
+      dataDescIdColumn(ms, casacore::MeasurementSet::columnName(
+                               casacore::MSMainEnums::DATA_DESC_ID));
+  casacore::ArrayColumn<bool> flagColumn(
+      ms, casacore::MeasurementSet::columnName(casacore::MSMainEnums::FLAG));
   std::vector<size_t> dataIdToSpw;
   MetaData().GetDataDescToBandVector(dataIdToSpw);
 
@@ -251,7 +253,7 @@ void MemoryBaselineReader::WriteToMs() {
     if (ant1 > ant2) std::swap(ant1, ant2);
 
     const size_t frequencyCount = MetaData().FrequencyCount(spw);
-    IPosition flagShape = IPosition(2);
+    casacore::IPosition flagShape = casacore::IPosition(2);
     flagShape[0] = polarizationCount;
     flagShape[1] = frequencyCount;
     casacore::Array<bool> flagArray(flagShape);
@@ -261,7 +263,7 @@ void MemoryBaselineReader::WriteToMs() {
         _baselines.find(baselineID);
     std::unique_ptr<Result>& result = resultIter->second;
 
-    Array<bool>::contiter flagPtr = flagArray.cbegin();
+    casacore::Array<bool>::contiter flagPtr = flagArray.cbegin();
 
     std::vector<Mask2D*> masks(polarizationCount);
     for (size_t p = 0; p != polarizationCount; ++p)
diff --git a/msio/memorybaselinereader.h b/msio/memorybaselinereader.h
index 970e825d65967a0978cdb077edb0a177b0b6c19e..0a8173a3f346efb501bc708f07dc07b098d9a0cb 100644
--- a/msio/memorybaselinereader.h
+++ b/msio/memorybaselinereader.h
@@ -68,12 +68,12 @@ class MemoryBaselineReader final : public BaselineReader {
     unsigned antenna1, antenna2, spw, sequenceId;
 
     bool operator<(const BaselineID& other) const {
-      if (antenna1 < other.antenna1)
+      if (antenna1 < other.antenna1) {
         return true;
-      else if (antenna1 == other.antenna1) {
-        if (antenna2 < other.antenna2)
+      } else if (antenna1 == other.antenna1) {
+        if (antenna2 < other.antenna2) {
           return true;
-        else if (antenna2 == other.antenna2) {
+        } else if (antenna2 == other.antenna2) {
           if (spw < other.spw)
             return true;
           else if (spw == other.spw)
diff --git a/msio/msstatreader.cpp b/msio/msstatreader.cpp
index a62de2d10ba3df6b5d31aec076aa2d7d4fee74de..aaad021b00bec4aceb8637f3107bdb412d58f054 100644
--- a/msio/msstatreader.cpp
+++ b/msio/msstatreader.cpp
@@ -12,7 +12,8 @@
 #include <casacore/tables/Tables/ArrayColumn.h>
 #include <casacore/tables/Tables/ScalarColumn.h>
 
-using namespace aocommon;
+using aocommon::Polarization;
+using aocommon::PolarizationEnum;
 
 MSStatReader::MSStatReader(const std::string& filename,
                            const std::string& dataColumn)
diff --git a/msio/parmtable.h b/msio/parmtable.h
index d8504a425441e312ec4306017994f274ba669ff5..92c3270b5d86282eb1551383ef9e07e0f90fa7bc 100644
--- a/msio/parmtable.h
+++ b/msio/parmtable.h
@@ -39,7 +39,7 @@ class ParmTable {
     }
   };
 
-  ParmTable(const std::string& path) : _path(path) { readNames(); }
+  explicit ParmTable(const std::string& path) : _path(path) { readNames(); }
 
   std::set<std::string> GetAntennas() const {
     std::set<std::string> antennas;
diff --git a/msio/reorderingbaselinereader.cpp b/msio/reorderingbaselinereader.cpp
index b81f0e228fd5d650cf0d4e00965770d4ffe2666d..9cbaa24e690b8b24bab891071c6bc58a4574eb73 100644
--- a/msio/reorderingbaselinereader.cpp
+++ b/msio/reorderingbaselinereader.cpp
@@ -82,11 +82,11 @@ void ReorderingBaselineReader::PerformReadRequests(
             width, MetaData().FrequencyCount(request.spectralWindow)));
       }
     }
-    if (read_uvw_)
+    if (read_uvw_) {
       _results[i]._uvw =
           direct_reader_.ReadUVW(request.antenna1, request.antenna2,
                                  request.spectralWindow, request.sequenceId);
-    else {
+    } else {
       _results[i]._uvw.clear();
       for (unsigned j = 0; j < width; ++j)
         _results[i]._uvw.emplace_back(0.0, 0.0, 0.0);
diff --git a/msio/singlebaselinefile.cpp b/msio/singlebaselinefile.cpp
index 7788ef824bd310f824b9976df534adf521b89081..ab783f5b580ce0d9a1cfc64bbf2361d450690744 100644
--- a/msio/singlebaselinefile.cpp
+++ b/msio/singlebaselinefile.cpp
@@ -6,8 +6,6 @@
 
 #define FILE_FORMAT_VERSION 1
 
-using namespace aocommon;
-
 void SingleBaselineFile::Read(std::istream& stream,
                               ProgressListener& progress) {
   if (!stream) throw std::runtime_error("Could not open file");
@@ -73,7 +71,8 @@ TimeFrequencyData SingleBaselineFile::UnserializeTFData(
   for (size_t i = 0; i != polCount; ++i) {
     TimeFrequencyData polData;
     const size_t polCode = Serializable::UnserializeUInt32(stream);
-    const PolarizationEnum pol = Polarization::AipsIndexToEnum(polCode);
+    const aocommon::PolarizationEnum pol =
+        aocommon::Polarization::AipsIndexToEnum(polCode);
     const uint32_t imageFlagBitset = Serializable::UnserializeUInt32(stream);
     const size_t imageCount = imageFlagBitset & 0x03;
     const size_t maskCount = (imageFlagBitset & 0x04) ? 1 : 0;
@@ -183,8 +182,9 @@ void SingleBaselineFile::Serialize(std::ostream& stream,
   }
   Serializable::SerializeToUInt32(stream, complCode);
   for (size_t i = 0; i != data.PolarizationCount(); ++i) {
-    const PolarizationEnum p = data.GetPolarization(i);
-    Serializable::SerializeToUInt32(stream, Polarization::EnumToAipsIndex(p));
+    const aocommon::PolarizationEnum p = data.GetPolarization(i);
+    Serializable::SerializeToUInt32(stream,
+                                    aocommon::Polarization::EnumToAipsIndex(p));
     unsigned int imageFlagBitset = 0;
     const TimeFrequencyData polData = data.MakeFromPolarizationIndex(i);
     if (polData.ImageCount() == 2) imageFlagBitset = imageFlagBitset | 0x02;
diff --git a/plot/colormap.h b/plot/colormap.h
index 1d5af07d4327fc77f93d8e16c15aa6fa28dd83bc..e98e9af2227c86881629618d5ec4888e7f848248 100644
--- a/plot/colormap.h
+++ b/plot/colormap.h
@@ -634,7 +634,7 @@ class ViridisMap : public ColorMap {
     return (size_t)d;
   }
 
-  const static double DATA_R[256], DATA_G[256], DATA_B[256];
+  static const double DATA_R[256], DATA_G[256], DATA_B[256];
 };
 
 template <int Saturation>
diff --git a/plot/heatmap.cpp b/plot/heatmap.cpp
index 8e7d1c0b860357221700e279be6329c50901466a..77a4ab6ae670cc40ed4779ccce0b043aba717975 100644
--- a/plot/heatmap.cpp
+++ b/plot/heatmap.cpp
@@ -401,8 +401,9 @@ void HeatMap::drawAll(const Cairo::RefPtr<Cairo::Context>& cairo, size_t width,
             else
               val = (std::log10(val) - minLog10) * 2.0 / (maxLog10 - minLog10) -
                     1.0;
-          } else
+          } else {
             val = (val - _derivedMin) * 2.0 / (_derivedMax - _derivedMin) - 1.0;
+          }
           if (val < -1.0)
             val = -1.0;
           else if (val > 1.0)
diff --git a/plot/horizontalplotscale.cpp b/plot/horizontalplotscale.cpp
index db6e10232ee5e2e5969ef24147acb55357c416c3..57f72092039d14176417af1db96c38e33f435c93 100644
--- a/plot/horizontalplotscale.cpp
+++ b/plot/horizontalplotscale.cpp
@@ -211,10 +211,10 @@ void HorizontalPlotScale::initializeLocalMetrics(
 }
 
 void HorizontalPlotScale::InitializeTicks() {
-  if (_isLogarithmic)
+  if (_isLogarithmic) {
     _tickSet =
         std::make_unique<LogarithmicTickSet>(_tickRange[0], _tickRange[1], 25);
-  else {
+  } else {
     switch (_axisType) {
       case AxisType::kNumeric:
         _tickSet =
diff --git a/plot/plotpropertieswindow.cpp b/plot/plotpropertieswindow.cpp
index 3b0122e2eb5f5a21eaf18d11f9c9270a943de31d..6f285cb7b655a06a84ddad6877c55bb6be8c1bdf 100644
--- a/plot/plotpropertieswindow.cpp
+++ b/plot/plotpropertieswindow.cpp
@@ -224,19 +224,19 @@ void PlotPropertiesWindow::updateVMinMaxEntries() {
 void PlotPropertiesWindow::onApplyClicked() {
   _plot.SetTitle(_titleEntry.get_text());
 
-  if (_minMaxVRangeButton.get_active())
+  if (_minMaxVRangeButton.get_active()) {
     _plot.YAxis().SetRangeDetermination(RangeDetermination::MinMaxRange);
-  else if (_winsorizedVRangeButton.get_active())
+  } else if (_winsorizedVRangeButton.get_active()) {
     _plot.YAxis().SetRangeDetermination(RangeDetermination::WinsorizedRange);
-  else if (_specifiedVRangeButton.get_active()) {
+  } else if (_specifiedVRangeButton.get_active()) {
     _plot.YAxis().SetRangeDetermination(RangeDetermination::SpecifiedRange);
     _plot.YAxis().SetMin(atof(_vRangeMinEntry.get_text().c_str()));
     _plot.YAxis().SetMax(atof(_vRangeMaxEntry.get_text().c_str()));
   }
 
-  if (_automaticHRangeButton.get_active())
+  if (_automaticHRangeButton.get_active()) {
     _plot.XAxis().SetRangeDetermination(RangeDetermination::MinMaxRange);
-  else {
+  } else {
     _plot.XAxis().SetRangeDetermination(RangeDetermination::SpecifiedRange);
     _plot.XAxis().SetMin(atof(_hRangeMinEntry.get_text().c_str()));
     _plot.XAxis().SetMax(atof(_hRangeMaxEntry.get_text().c_str()));
diff --git a/plot/ticksets/logarithmictickset.h b/plot/ticksets/logarithmictickset.h
index 43e65cd418ce956036193af89bfb8a4a535d170a..e491c4ebbfaace8b1d0aeb5e892577dc1576dcc8 100644
--- a/plot/ticksets/logarithmictickset.h
+++ b/plot/ticksets/logarithmictickset.h
@@ -66,8 +66,9 @@ class LogarithmicTickSet : public TickSet {
         out << kToSuperTable[c - '0'];
       } else if (c == '-') {
         out << "⁻";
-      } else
+      } else {
         out << c;
+      }
     }
     return out.str();
   }
diff --git a/plot/ticksets/numerictickset.h b/plot/ticksets/numerictickset.h
index 298756eb0aa197bf70d210ceb8b70c88604e6550..1e6fa7e2b87a39baf99ad60bbb724c923fec565f 100644
--- a/plot/ticksets/numerictickset.h
+++ b/plot/ticksets/numerictickset.h
@@ -51,9 +51,9 @@ class NumericTickSet final : public TickSet {
 
   void set(size_t sizeRequest) {
     if (std::isfinite(_min) && std::isfinite(_max)) {
-      if (_max == _min)
+      if (_max == _min) {
         _ticks.push_back(_min);
-      else {
+      } else {
         if (sizeRequest == 0) return;
         double tickWidth =
             roundUpToNiceNumber(std::fabs(_max - _min) / (double)sizeRequest);
@@ -86,9 +86,9 @@ class NumericTickSet final : public TickSet {
     if (!std::isfinite(number)) return number;
     double roundedNumber = 1.0;
     if (number <= 0.0) {
-      if (number == 0.0)
+      if (number == 0.0) {
         return 0.0;
-      else {
+      } else {
         roundedNumber = -1.0;
         number *= -1.0;
       }
diff --git a/plot/ticksets/timetickset.h b/plot/ticksets/timetickset.h
index bb9455cce4ae3c237f0adfe0031658d707461a5e..f051e6471939cd6efb8e41e8043d03da058d42ac 100644
--- a/plot/ticksets/timetickset.h
+++ b/plot/ticksets/timetickset.h
@@ -43,9 +43,9 @@ class TimeTickSet final : public TickSet {
 
  private:
   void set(size_t sizeRequest) {
-    if (_max == _min)
+    if (_max == _min) {
       _ticks.push_back(_min);
-    else {
+    } else {
       if (sizeRequest == 0) return;
       double tickWidth =
           calculateTickWidth((_max - _min) / (double)sizeRequest);
@@ -64,29 +64,25 @@ class TimeTickSet final : public TickSet {
 
     // number is in units of seconds
 
-    // In days?
-    if (lowerLimit >= 60.0 * 60.0 * 24.0) {
+    if (lowerLimit >= 60.0 * 60.0 * 24.0) {  // In days?
       double width = 60.0 * 60.0 * 24.0;
       while (width < lowerLimit) width *= 2.0;
       return width;
-    }
-    // in hours?
-    else if (lowerLimit > 60.0 * 30.0) {
-      if (lowerLimit <= 60.0 * 60.0)
+    } else if (lowerLimit > 60.0 * 30.0) {  // in hours?
+      if (lowerLimit <= 60.0 * 60.0) {
         return 60.0 * 60.0;  // hours
-      else if (lowerLimit <= 60.0 * 60.0 * 2.0)
+      } else if (lowerLimit <= 60.0 * 60.0 * 2.0) {
         return 60.0 * 60.0 * 2.0;  // two hours
-      else if (lowerLimit <= 60.0 * 60.0 * 3.0)
+      } else if (lowerLimit <= 60.0 * 60.0 * 3.0) {
         return 60.0 * 60.0 * 3.0;  // three hours
-      else if (lowerLimit <= 60.0 * 60.0 * 4.0)
+      } else if (lowerLimit <= 60.0 * 60.0 * 4.0) {
         return 60.0 * 60.0 * 4.0;  // four hours
-      else if (lowerLimit <= 60.0 * 60.0 * 6.0)
+      } else if (lowerLimit <= 60.0 * 60.0 * 6.0) {
         return 60.0 * 60.0 * 6.0;  // six hours
-      else
+      } else {
         return 60.0 * 60.0 * 12.0;  // twelve hours
-    }
-    // in minutes?
-    else if (lowerLimit > 30.0) {
+      }
+    } else if (lowerLimit > 30.0) {  // in minutes?
       if (lowerLimit <= 60.0)
         return 60.0;  // in minutes
       else if (lowerLimit <= 60.0 * 2.0)
@@ -98,10 +94,8 @@ class TimeTickSet final : public TickSet {
       else if (lowerLimit <= 60.0 * 15.0)
         return 60.0 * 15.0;  // quarter hours
       else
-        return 60.0 * 30.0;  // half hours
-    }
-    // in seconds?
-    else if (lowerLimit > 0.5) {
+        return 60.0 * 30.0;         // half hours
+    } else if (lowerLimit > 0.5) {  // in seconds?
       if (lowerLimit <= 1.0)
         return 1.0;  // in seconds
       else if (lowerLimit <= 2.0)
@@ -114,10 +108,9 @@ class TimeTickSet final : public TickSet {
         return 15.0;  // quarter minute
       else
         return 30.0;  // half a minute
-    } else if (lowerLimit == 0.0)
+    } else if (lowerLimit == 0.0) {
       return 0.0;
-    // in 10th of seconds or lower?
-    else {
+    } else {  // in 10th of seconds or lower?
       double factor = 1.0;
       while (lowerLimit <= 0.1 && std::isfinite(lowerLimit)) {
         factor *= 0.1;
diff --git a/plot/vectorimage.cpp b/plot/vectorimage.cpp
index 4cc13f36a4db420d35e95d894a6884e39063ea43..c5e62b20acddad4702603d206f1b2ad39a4f33c6 100644
--- a/plot/vectorimage.cpp
+++ b/plot/vectorimage.cpp
@@ -2,9 +2,9 @@
 
 std::unique_ptr<VectorImage> ShrinkHorizontally(const ImageInterface& source,
                                                 size_t shrinkFactor) {
-  if (source.Width() == 0)
+  if (source.Width() == 0) {
     return std::unique_ptr<VectorImage>(new VectorImage());
-  else {
+  } else {
     const size_t newWidth = (source.Width() + shrinkFactor - 1) / shrinkFactor;
     const size_t height = source.Height();
 
diff --git a/plot/xyplot.cpp b/plot/xyplot.cpp
index a7014b56f5e8a020bfdd5cfba78651f646037b9f..d454b528e59f597af2ef21cac78e355854a95107 100644
--- a/plot/xyplot.cpp
+++ b/plot/xyplot.cpp
@@ -337,11 +337,11 @@ void XYPlot::DrawPointSet(const Cairo::RefPtr<Cairo::Context>& cr,
 
 std::pair<double, double> XYPlot::RangeX(bool second_axis) const {
   const XYPlotAxis& axis = second_axis ? x2_axis_ : x_axis_;
-  if (axis.GetRangeDetermination() == RangeDetermination::SpecifiedRange)
+  if (axis.GetRangeDetermination() == RangeDetermination::SpecifiedRange) {
     return std::make_pair(axis.SpecifiedMin(), axis.SpecifiedMax());
-  else if (_pointSets.empty())
+  } else if (_pointSets.empty()) {
     return std::make_pair(0.0, 1.0);
-  else {
+  } else {
     const double maxX = _system.XRangeMax(second_axis);
     const double minX = _system.XRangeMin(second_axis);
     return std::make_pair(minX, maxX);
@@ -349,11 +349,11 @@ std::pair<double, double> XYPlot::RangeX(bool second_axis) const {
 }
 
 std::pair<double, double> XYPlot::RangePositiveX(bool second_axis) const {
-  if (x_axis_.GetRangeDetermination() == RangeDetermination::SpecifiedRange)
+  if (x_axis_.GetRangeDetermination() == RangeDetermination::SpecifiedRange) {
     return std::make_pair(x_axis_.SpecifiedMin(), x_axis_.SpecifiedMax());
-  else if (_pointSets.empty())
+  } else if (_pointSets.empty()) {
     return std::make_pair(0.1, 1.0);
-  else {
+  } else {
     const double maxX = _system.XRangePositiveMax(second_axis);
     const double minX = _system.XRangePositiveMin(second_axis);
     return std::make_pair(minX, maxX);
@@ -362,11 +362,11 @@ std::pair<double, double> XYPlot::RangePositiveX(bool second_axis) const {
 
 std::pair<double, double> XYPlot::RangeY(bool second_axis) const {
   const XYPlotAxis& axis = second_axis ? y2_axis_ : y_axis_;
-  if (axis.GetRangeDetermination() == RangeDetermination::SpecifiedRange)
+  if (axis.GetRangeDetermination() == RangeDetermination::SpecifiedRange) {
     return std::make_pair(axis.SpecifiedMin(), axis.SpecifiedMax());
-  else if (_pointSets.empty())
+  } else if (_pointSets.empty()) {
     return std::make_pair(0.0, 1.0);
-  else {
+  } else {
     double minY = _system.YRangeMin(second_axis),
            maxY = _system.YRangeMax(second_axis),
            extMin = minY * 1.07 - maxY * 0.07,
@@ -380,11 +380,11 @@ std::pair<double, double> XYPlot::RangeY(bool second_axis) const {
 }
 
 std::pair<double, double> XYPlot::RangePositiveY(bool second_axis) const {
-  if (y_axis_.GetRangeDetermination() == RangeDetermination::SpecifiedRange)
+  if (y_axis_.GetRangeDetermination() == RangeDetermination::SpecifiedRange) {
     return std::make_pair(y_axis_.SpecifiedMin(), y_axis_.SpecifiedMax());
-  else if (_pointSets.empty())
+  } else if (_pointSets.empty()) {
     return std::make_pair(0.1, 1.0);
-  else {
+  } else {
     const double maxY = std::log(_system.YRangePositiveMax(second_axis));
     const double minY = std::log(_system.YRangePositiveMin(second_axis));
     const double extMin = std::exp(minY * 1.07 - maxY * 0.07);
diff --git a/plot/xypointset.h b/plot/xypointset.h
index 02960140e57080e02957db8a323de58bbaf036c4..84cbc6238bee86f7b704a2cd5e8c42d204e4e2a3 100644
--- a/plot/xypointset.h
+++ b/plot/xypointset.h
@@ -8,8 +8,7 @@
 
 class XYPointSet {
  public:
-  XYPointSet(size_t colorIndex) : color_index_(colorIndex) {}
-  ~XYPointSet() {}
+  explicit XYPointSet(size_t colorIndex) : color_index_(colorIndex) {}
 
   enum DrawingStyle { DrawLines, DrawPoints, DrawColumns };
 
@@ -130,9 +129,9 @@ class XYPointSet {
   }
 
   double XRangePositiveMin() const {
-    if (points_.empty())
+    if (points_.empty()) {
       return 1.0;
-    else {
+    } else {
       std::vector<Point2D>::const_iterator iter =
           std::upper_bound(points_.begin(), points_.end(), Point2D(0.0, 0.0));
       if (iter == points_.end() || iter->x < 0.0 || !std::isfinite(iter->x))
diff --git a/python/pyinterface.cpp b/python/pyinterface.cpp
index bac240da7ea61a3e627c1a94a5f5ff7256574bcb..0d516df17f96ca433f188cdb1634fd21a7792572 100644
--- a/python/pyinterface.cpp
+++ b/python/pyinterface.cpp
@@ -3,8 +3,6 @@
 
 #include "pyfunctions.h"
 
-#include <aocommon/polarization.h>
-
 #include <pybind11/pybind11.h>
 #include <pybind11/operators.h>
 
@@ -12,8 +10,6 @@
 
 namespace py = pybind11;
 
-using namespace aocommon;
-
 PYBIND11_MODULE(aoflagger, m) {
   m.doc() = "AOFlagger module for detection of radio-frequency interference";
 
diff --git a/quality/histogramtablesformatter.h b/quality/histogramtablesformatter.h
index 9e5b76343eca4e67ad3e18cc9b9e425937c493ce..f07e1ceabd3c5a060c9a21d356dbdf336cd079c8 100644
--- a/quality/histogramtablesformatter.h
+++ b/quality/histogramtablesformatter.h
@@ -109,13 +109,13 @@ class HistogramTablesFormatter {
   void operator=(const HistogramTablesFormatter&) =
       delete;  // don't allow assignment
 
-  const static std::string ColumnNameType;
-  const static std::string ColumnNameName;
-  const static std::string ColumnNamePolarization;
+  static const std::string ColumnNameType;
+  static const std::string ColumnNameName;
+  static const std::string ColumnNamePolarization;
 
-  const static std::string ColumnNameBinStart;
-  const static std::string ColumnNameBinEnd;
-  const static std::string ColumnNameCount;
+  static const std::string ColumnNameBinStart;
+  static const std::string ColumnNameBinEnd;
+  static const std::string ColumnNameCount;
 
   std::unique_ptr<casacore::Table> _measurementSet;
   const std::string _measurementSetName;
diff --git a/quality/qualitytablesformatter.cpp b/quality/qualitytablesformatter.cpp
index ee18db94674445144b980448fa694ce3ef55974e..768f7bdf2ce41eea4a48467df1d5287320336417 100644
--- a/quality/qualitytablesformatter.cpp
+++ b/quality/qualitytablesformatter.cpp
@@ -125,9 +125,9 @@ void QualityTablesFormatter::InitializeEmptyStatistic(
   if (!TableExists(KindNameTable)) createKindNameTable();
 
   const QualityTable table = DimensionToTable(dimension);
-  if (!TableExists(table))
+  if (!TableExists(table)) {
     InitializeEmptyTable(table, polarizationCount);
-  else {
+  } else {
     removeStatisticFromStatTable(table, kind);
   }
 }
diff --git a/quality/qualitytablesformatter.h b/quality/qualitytablesformatter.h
index 093108c54d33552c109033454df1d2c4e7b6e29c..36e08a26402fd0c72aaf629e8c739564d1f1d028 100644
--- a/quality/qualitytablesformatter.h
+++ b/quality/qualitytablesformatter.h
@@ -202,17 +202,17 @@ class QualityTablesFormatter {
   void operator=(const QualityTablesFormatter&) =
       delete;  // don't allow assignment
 
-  const static std::string _kindToNameTable[];
-  const static std::string _tableToNameTable[];
-  const static enum QualityTable _dimensionToTableTable[];
-
-  const static std::string ColumnNameAntenna1;
-  const static std::string ColumnNameAntenna2;
-  const static std::string ColumnNameFrequency;
-  const static std::string ColumnNameKind;
-  const static std::string ColumnNameName;
-  const static std::string ColumnNameTime;
-  const static std::string ColumnNameValue;
+  static const std::string _kindToNameTable[];
+  static const std::string _tableToNameTable[];
+  static const QualityTable _dimensionToTableTable[];
+
+  static const std::string ColumnNameAntenna1;
+  static const std::string ColumnNameAntenna2;
+  static const std::string ColumnNameFrequency;
+  static const std::string ColumnNameKind;
+  static const std::string ColumnNameName;
+  static const std::string ColumnNameTime;
+  static const std::string ColumnNameValue;
 
   std::unique_ptr<casacore::Table> _measurementSet;
   const std::string _measurementSetName;
diff --git a/rfigui/controllers/imagecomparisoncontroller.cpp b/rfigui/controllers/imagecomparisoncontroller.cpp
index b763e564a0bdfe0194900ef05c9b2bafd961b2a0..47f1ba0e326b407a6401e0d806fa4120033806c5 100644
--- a/rfigui/controllers/imagecomparisoncontroller.cpp
+++ b/rfigui/controllers/imagecomparisoncontroller.cpp
@@ -167,11 +167,11 @@ void ImageComparisonController::TryVisualizePolarizations(bool& pp, bool& pq,
 
 Mask2DCPtr ImageComparisonController::getSelectedPolarizationMask(
     const TimeFrequencyData& data) const {
-  if (data.MaskCount() == 0)
+  if (data.MaskCount() == 0) {
     return Mask2DCPtr();
-  else if (data.MaskCount() == 1)
+  } else if (data.MaskCount() == 1) {
     return data.GetSingleMask();
-  else {
+  } else {
     if (data.MaskCount() == 4) {
       if (_showPP && _showQQ) {
         Mask2DPtr mask = Mask2D::MakePtr(*data.GetMask(0));
@@ -181,24 +181,25 @@ Mask2DCPtr ImageComparisonController::getSelectedPolarizationMask(
         Mask2DPtr mask = Mask2D::MakePtr(*data.GetMask(1));
         mask->Join(*data.GetMask(2));
         return mask;
-      } else if (_showPP)
+      } else if (_showPP) {
         return data.GetMask(0);
-      else if (_showPQ)
+      } else if (_showPQ) {
         return data.GetMask(1);
-      else if (_showQP)
+      } else if (_showQP) {
         return data.GetMask(2);
-      else  // if(_showQQ)
+      } else {  // if(_showQQ)
         return data.GetMask(3);
-    } else  // data->MaskCount() == 2
-    {
+      }
+    } else {  // data->MaskCount() == 2
       if (_showPP && _showQQ) {
         Mask2DPtr mask = Mask2D::MakePtr(*data.GetMask(0));
         mask->Join(*data.GetMask(1));
         return mask;
-      } else if (_showPP)
+      } else if (_showPP) {
         return data.GetMask(0);
-      else  // if(_showQQ)
+      } else {  // if(_showQQ)
         return data.GetMask(1);
+      }
     }
   }
 }
diff --git a/rfigui/controllers/imagecomparisoncontroller.h b/rfigui/controllers/imagecomparisoncontroller.h
index c48f0af34a8a14c8778488374caa908fd6e1c81d..5d5c1adb39350ea65a1e69e5ee21c9ec374a7c28 100644
--- a/rfigui/controllers/imagecomparisoncontroller.h
+++ b/rfigui/controllers/imagecomparisoncontroller.h
@@ -53,15 +53,16 @@ class ImageComparisonController {
    */
   TimeFrequencyData AltMaskData() const {
     if (_visualizedImage == 0) {
-      if (_dataList.size() > 1)
+      if (_dataList.size() > 1) {
         return _dataList.back().data;
-      else {
+      } else {
         TimeFrequencyData empty = _dataList.back().data;
         empty.SetNoMask();
         return empty;
       }
-    } else
+    } else {
       return _dataList[_visualizedImage].data;
+    }
   }
 
   size_t AddVisualization(const std::string& label,
@@ -150,12 +151,13 @@ class ImageComparisonController {
     if (orActive && altActive) {
       data.SetMask(_dataList[0].data);
       data.JoinMask(_dataList[altMaskIndex].data);
-    } else if (orActive)
+    } else if (orActive) {
       data.SetMask(_dataList[0].data);
-    else if (altActive)
+    } else if (altActive) {
       data.SetMask(_dataList[altMaskIndex].data);
-    else
+    } else {
       data.SetMasksToValue<false>();
+    }
   }
   MaskedHeatMap _plot;
   bool _showPP, _showPQ, _showQP, _showQQ;
diff --git a/rfigui/controllers/rfiguicontroller.cpp b/rfigui/controllers/rfiguicontroller.cpp
index 10e7310d93fe78c300381276b5c1c42d8262d211..12c442d70cd1ce01a90b753d76980f7d7579aba5 100644
--- a/rfigui/controllers/rfiguicontroller.cpp
+++ b/rfigui/controllers/rfiguicontroller.cpp
@@ -163,9 +163,9 @@ void RFIGuiController::PlotPowerSpectrum() {
 
     const TimeFrequencyData data = ActiveData();
     std::array<Image2DCPtr, 2> images;
-    if (data.ComplexRepresentation() == TimeFrequencyData::ComplexParts)
+    if (data.ComplexRepresentation() == TimeFrequencyData::ComplexParts) {
       images = data.GetSingleComplexImage();
-    else {
+    } else {
       images[0] = data.GetSingleImage();
       images[1] = images[0];
     }
diff --git a/rfigui/maskedheatmap.cpp b/rfigui/maskedheatmap.cpp
index e571671714186a3115060bd687981679e13b1390..b7a6b09b9be60514b9bbca77c02eb514d2008f41 100644
--- a/rfigui/maskedheatmap.cpp
+++ b/rfigui/maskedheatmap.cpp
@@ -46,8 +46,9 @@ Mask2DCPtr MaskedHeatMap::GetActiveMask() const {
       Mask2DPtr mask = Mask2D::MakePtr(*_originalMask);
       mask->Join(*_alternativeMask);
       return mask;
-    } else
+    } else {
       return _originalMask;
+    }
   } else {
     if (altActive)
       return _alternativeMask;
diff --git a/rfigui/plotframe.cpp b/rfigui/plotframe.cpp
index 56f14c059c1930941fff9538be975f118cbbfbea..20fd957e306f8c6fa4bcb87150db8243deb35cfb 100644
--- a/rfigui/plotframe.cpp
+++ b/rfigui/plotframe.cpp
@@ -4,7 +4,7 @@
 
 #include "plotframe.h"
 
-using namespace aocommon;
+using aocommon::Polarization;
 
 PlotFrame::PlotFrame()
     : _plotData(nullptr),
@@ -53,7 +53,7 @@ void PlotFrame::plot() {
 
 void PlotFrame::plotTimeGraph(const TimeFrequencyData& data,
                               const std::string& label,
-                              PolarizationEnum polarisation) {
+                              aocommon::PolarizationEnum polarisation) {
   plotTimeGraph(data.Make(polarisation), label);
 }
 
diff --git a/rfigui/plotwindow.cpp b/rfigui/plotwindow.cpp
index 0ac61e1d251762da2157531756febd9b44f8b509..a51827dbec7efbc55cd47711c030db3db89d2719 100644
--- a/rfigui/plotwindow.cpp
+++ b/rfigui/plotwindow.cpp
@@ -106,7 +106,6 @@ void PlotWindow::onEditPlottingPropertiesPressed() {
     _plotPropertiesWindow = new PlotPropertiesWindow(plot, "Plot properties");
     _plotPropertiesWindow->OnChangesApplied =
         std::bind(&PlotWindow::onPlotPropertiesChanged, this);
-    ;
     _plotPropertiesWindow->show();
     _plotPropertiesWindow->raise();
   }
diff --git a/rfigui/progresswindow.cpp b/rfigui/progresswindow.cpp
index 4b024d693210f40732cf2b1d01e50fe256be4554..9ec68e56ee0dbfa6e886377d74b8eab3286d5c4c 100644
--- a/rfigui/progresswindow.cpp
+++ b/rfigui/progresswindow.cpp
@@ -50,7 +50,7 @@ ProgressWindow::ProgressWindow()
       sigc::mem_fun(*this, &ProgressWindow::updateProgress));
 }
 
-ProgressWindow::~ProgressWindow() {}
+ProgressWindow::~ProgressWindow() = default;
 
 void ProgressWindow::updateProgress() {
   if (!_blockProgressSignal) {
diff --git a/rfigui/progresswindow.h b/rfigui/progresswindow.h
index 250f539b4147e0974f6badcfe6e10b815f936f1b..79feca7217989d819badb69dd4c5985936ea2770 100644
--- a/rfigui/progresswindow.h
+++ b/rfigui/progresswindow.h
@@ -17,7 +17,7 @@
 
 class ProgressWindow : public Gtk::Window, public ProgressListener {
  public:
-  explicit ProgressWindow();
+  ProgressWindow();
   ~ProgressWindow();
 
   virtual void OnStartTask(const std::string& description) final override;
diff --git a/rfigui/rfiguiwindow.cpp b/rfigui/rfiguiwindow.cpp
index 15ed0262abb22c1b0ae072556ffd6b9f018ebb53..2fbcebd84f2d5e969161ad9979e51b4d75dd080a 100644
--- a/rfigui/rfiguiwindow.cpp
+++ b/rfigui/rfiguiwindow.cpp
@@ -280,11 +280,11 @@ bool RFIGuiWindow::askToSaveChanges() {
     dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
     dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_YES);
     const int result = dialog.run();
-    if (result == Gtk::RESPONSE_CANCEL)
+    if (result == Gtk::RESPONSE_CANCEL) {
       return false;
-    else if (result == Gtk::RESPONSE_CLOSE)
+    } else if (result == Gtk::RESPONSE_CLOSE) {
       return true;
-    else {
+    } else {
       onStrategySave();
       // In case the strategy had no name yet, the onStrategySave() call will
       // show a file dialog where the user might press cancel. In that case,
@@ -504,8 +504,9 @@ void RFIGuiWindow::onViewTimePlot() {
   if (viewTime) {
     _timeFrequencyWidget.EnableTimePlot();
     _controller->DrawTimeMean(_timeFrequencyWidget.TimePlot());
-  } else
+  } else {
     _timeFrequencyWidget.DisableTimePlot();
+  }
 }
 
 void RFIGuiWindow::onExecuteLuaStrategy() {
@@ -1305,10 +1306,10 @@ void RFIGuiWindow::onStrategyOpenDefault(const std::string& name) {
     const TelescopeFile::TelescopeId id =
         TelescopeFile::TelescopeIdFromName(name);
     const std::string filename = TelescopeFile::FindStrategy(id);
-    if (filename.empty())
+    if (filename.empty()) {
       showError("Could not find default strategy file for telescope '" + name +
                 "' -- aoflagger is probably not installed properly");
-    else {
+    } else {
       _controller->OpenStrategy(filename);
       _strategyEditor.SetText(_controller->GetWorkStrategyText());
       _strategyEditor.ResetChangedStatus();
@@ -1322,8 +1323,9 @@ void RFIGuiWindow::onStrategySave() {
     _controller->SetWorkStrategyText(_strategyEditor.GetText());
     _controller->SaveStrategy();
     _strategyEditor.ResetChangedStatus();
-  } else
+  } else {
     onStrategySaveAs();
+  }
 }
 
 void RFIGuiWindow::onStrategySaveAs() {
diff --git a/rfigui/settings.h b/rfigui/settings.h
index 748f891fa5962305bbd473923f2f9f689de9e23f..3aa66f9b4b3a23c83766940eb4910763c7d0e2ce 100644
--- a/rfigui/settings.h
+++ b/rfigui/settings.h
@@ -35,7 +35,7 @@ class StringSetting final : public SettingValue {
 
 class SettingItem {
  public:
-  SettingItem(std::unique_ptr<SettingValue> defaultValue)
+  explicit SettingItem(std::unique_ptr<SettingValue> defaultValue)
       : _defaultValue(std::move(defaultValue)) {}
   bool HasValue() const { return _value != nullptr; }
   SettingValue& Value() { return *_value; }
@@ -112,9 +112,10 @@ class Settings {
 
   void setStr(const std::string& key, const std::string& value) {
     SettingItem& item = _settings.find(key)->second;
-    if (static_cast<const StringSetting&>(item.DefaultValue()).Value() == value)
+    if (static_cast<const StringSetting&>(item.DefaultValue()).Value() ==
+        value) {
       item.MakeDefault();
-    else {
+    } else {
       if (!item.HasValue()) item.SetValue(item.DefaultValue().Create());
       static_cast<StringSetting&>(item.Value()).Value() = value;
     }
diff --git a/rfigui/strategyeditor.cpp b/rfigui/strategyeditor.cpp
index a5d603376d7c91350d5afa5d9d3ea8ce23cbcbbc..47083581f43c25b996d69d47740bb657ad6e21cb 100644
--- a/rfigui/strategyeditor.cpp
+++ b/rfigui/strategyeditor.cpp
@@ -124,8 +124,9 @@ void StrategyEditor::updateHighlighting() {
           _text.get_buffer()->apply_tag(_tagComment, wordStart, iter);
           mode = Clear;
           p.state = ParseInfo::Clear;
-        } else if (c == '[')
+        } else if (c == '[') {
           mode = LongCommentStart;
+        }
         break;
       case LongCommentStart:
         if (c == '[')
diff --git a/rfigui/timefrequencywidget.h b/rfigui/timefrequencywidget.h
index 04b57f305329df339ffb57ca6881ab6064f7d0a7..f69f637bdbb8058a5c6c6cbbbbb7d501a649b7e1 100644
--- a/rfigui/timefrequencywidget.h
+++ b/rfigui/timefrequencywidget.h
@@ -10,7 +10,7 @@
 
 class TimeFrequencyWidget : public Gtk::VBox {
  public:
-  TimeFrequencyWidget(MaskedHeatMap& plot) : _heatMap() {
+  explicit TimeFrequencyWidget(MaskedHeatMap& plot) : _heatMap() {
     _heatMap.SetPlot(plot);
     _timePlotWidget.SetPlot(_timePlot);
     _timePlotWidget.set_size_request(200, 60);
diff --git a/scripts/run-cpplint.sh b/scripts/run-cpplint.sh
new file mode 100755
index 0000000000000000000000000000000000000000..0644290f01a06fefdea521723521f51bde73a98b
--- /dev/null
+++ b/scripts/run-cpplint.sh
@@ -0,0 +1,3 @@
+cd ..
+cpplint --verbose=4 --filter=-legal/copyright,-build/header_guard,-build/c++11,-build/include_subdir,-build/include_order,-readability/casting,-runtime/int --recursive --exclude=build --exclude=external --extensions=cpp,h .
+cd scripts
diff --git a/structures/msmetadata.h b/structures/msmetadata.h
index 4604b6f617cdf14a156ac7a330dfce66c4f845e1..4feb3bdf72cf1cf89bd05dcc32d94cbebaee7252 100644
--- a/structures/msmetadata.h
+++ b/structures/msmetadata.h
@@ -155,15 +155,15 @@ class MSMetaData {
     unsigned fieldId;
 
     bool operator<(const Sequence& rhs) const {
-      if (antenna1 < rhs.antenna1)
+      if (antenna1 < rhs.antenna1) {
         return true;
-      else if (antenna1 == rhs.antenna1) {
-        if (antenna2 < rhs.antenna2)
+      } else if (antenna1 == rhs.antenna1) {
+        if (antenna2 < rhs.antenna2) {
           return true;
-        else if (antenna2 == rhs.antenna2) {
-          if (spw < rhs.spw)
+        } else if (antenna2 == rhs.antenna2) {
+          if (spw < rhs.spw) {
             return true;
-          else if (spw == rhs.spw) {
+          } else if (spw == rhs.spw) {
             return sequenceId < rhs.sequenceId;
           }
         }
diff --git a/structures/timefrequencydata.cpp b/structures/timefrequencydata.cpp
index 5be7b0773d8ebd3f6a3196a229b2e8ba16f1f5fa..760e257cd7b7417aac3a0ced3db9c1db1760c6f0 100644
--- a/structures/timefrequencydata.cpp
+++ b/structures/timefrequencydata.cpp
@@ -75,11 +75,11 @@ Image2DCPtr TimeFrequencyData::getSinglePhaseFromTwoPolPhase(
 }
 
 Mask2DCPtr TimeFrequencyData::GetCombinedMask() const {
-  if (MaskCount() == 0)
+  if (MaskCount() == 0) {
     return GetSetMask<false>();
-  else if (MaskCount() == 1)
+  } else if (MaskCount() == 1) {
     return GetMask(0);
-  else {
+  } else {
     Mask2DPtr mask(new Mask2D(*GetMask(0)));
     size_t i = 0;
     while (i != MaskCount()) {
@@ -114,9 +114,9 @@ TimeFrequencyData TimeFrequencyData::MakeZeroLinearData(size_t width,
 
 TimeFrequencyData TimeFrequencyData::Make(
     enum ComplexRepresentation representation) const {
-  if (representation == _complexRepresentation)
+  if (representation == _complexRepresentation) {
     return TimeFrequencyData(*this);
-  else if (_complexRepresentation == ComplexParts) {
+  } else if (_complexRepresentation == ComplexParts) {
     TimeFrequencyData data;
     data._complexRepresentation = representation;
     data._data.resize(_data.size());
@@ -148,10 +148,11 @@ TimeFrequencyData TimeFrequencyData::Make(
   } else if (representation == ComplexParts &&
              _complexRepresentation == AmplitudePart) {
     return MakeFromComplexCombination(*this, *this);
-  } else
+  } else {
     throw std::runtime_error(
         "Request for time/frequency data with a phase representation that can "
         "not be extracted from the source (source is not complex)");
+  }
 }
 
 TimeFrequencyData TimeFrequencyData::MakeFromComplexCombination(
@@ -271,9 +272,10 @@ void TimeFrequencyData::JoinMask(const TimeFrequencyData& other) {
   } else if (MaskCount() == 0 && _data.size() == other._data.size()) {
     for (size_t i = 0; i != _data.size(); ++i)
       _data[i]._flagging = other._data[i]._flagging;
-  } else
+  } else {
     throw std::runtime_error(
         "Joining time frequency flagging with incompatible structures");
+  }
 }
 
 std::vector<std::complex<num_t>> ToComplexVector(
diff --git a/structures/timefrequencydata.h b/structures/timefrequencydata.h
index 6c43a02b0a63fe21b48604f5365556c7cb1732f0..80533f9d948684cecf81c3931fe3948ca8fa1839 100644
--- a/structures/timefrequencydata.h
+++ b/structures/timefrequencydata.h
@@ -313,8 +313,7 @@ class TimeFrequencyData {
             throw std::runtime_error(
                 "Polarization not available or not implemented");
         }
-      } else  // _complexRepresentation != ComplexParts
-      {
+      } else {  // _complexRepresentation != ComplexParts
         // TODO should be done on only real or imaginary
         switch (polarization) {
           case aocommon::Polarization::StokesI:
@@ -388,10 +387,11 @@ class TimeFrequencyData {
                   "polarizations");
           }
         }
-      } else
+      } else {
         throw std::runtime_error(
             "Trying to convert the polarization in time frequency data in an "
             "invalid way");
+      }
     }
     newData.SetGlobalMask(GetMask(polarization));
     return newData;
@@ -713,9 +713,9 @@ class TimeFrequencyData {
       case ComplexParts:
         break;
     }
-    if (_data.empty())
+    if (_data.empty()) {
       s << "empty";
-    else {
+    } else {
       s << "("
         << aocommon::Polarization::TypeToFullString(_data[0]._polarization);
       for (size_t i = 1; i != _data.size(); ++i)
@@ -745,13 +745,13 @@ class TimeFrequencyData {
   }
 
   void SetPolarizationData(size_t polarizationIndex, TimeFrequencyData&& data) {
-    if (data.PolarizationCount() != 1)
+    if (data.PolarizationCount() != 1) {
       throw std::runtime_error(
           "Trying to set multiple polarizations by single polarization index");
-    else if (data.ComplexRepresentation() != ComplexRepresentation())
+    } else if (data.ComplexRepresentation() != ComplexRepresentation()) {
       throw std::runtime_error(
           "Trying to combine TFData's with different complex representations");
-    else {
+    } else {
       _data[polarizationIndex] = std::move(data._data[0]);
       data._data.clear();
     }
@@ -835,22 +835,24 @@ class TimeFrequencyData {
         return getSinglePhaseFromTwoPolPhase(0, 1);
       else
         return getFirstSum(0, 1);
-    } else  // if(_data.size() == 1)
+    } else {  // if(_data.size() == 1)
       return _data[0]._images[0];
+    }
   }
 
   void CopyFlaggingTo(TimeFrequencyData* data) const {
-    if (MaskCount() == 0)
+    if (MaskCount() == 0) {
       data->SetNoMask();
-    else if (MaskCount() == 1)
+    } else if (MaskCount() == 1) {
       data->SetGlobalMask(GetMask(0));
-    else {
+    } else {
       if (_data.size() == data->_data.size()) {
         for (size_t i = 0; i != _data.size(); ++i)
           data->_data[i]._flagging = _data[i]._flagging;
-      } else
+      } else {
         throw std::runtime_error(
             "Trying to copy flagging from incompatible time frequency data");
+      }
     }
   }
 
diff --git a/structures/versionstring.h b/structures/versionstring.h
index 1c7a16c10fe65f9945292f14035df268d0c5fd50..1ad2685d63d6a1404b058e2fedde4fc8beb5d8c9 100644
--- a/structures/versionstring.h
+++ b/structures/versionstring.h
@@ -9,7 +9,7 @@ class VersionString {
   VersionString()
       : _major(0), _minor(0), _subminor(0), _hasMinor(0), _hasSubminor(0) {}
 
-  VersionString(const std::string& str) {
+  explicit VersionString(const std::string& str) {
     if (str.empty()) throw std::runtime_error("Empty version string specified");
     for (size_t i = 0; i != str.size(); ++i)
       if (str[i] != '.' && (str[i] < '0' || str[i] > '9'))
@@ -51,8 +51,9 @@ class VersionString {
       } else {
         return std::to_string(_major) + '.' + std::to_string(_minor);
       }
-    } else
+    } else {
       return std::to_string(_major);
+    }
   }
 
  private:
diff --git a/test/lua/flagnanstest.cpp b/test/lua/flagnanstest.cpp
index 9ac9fda8935ff8499767a28611eab76ffa1ecc29..645faf7b4e1eef2aab4dd664f8f54fe17ae1c38f 100644
--- a/test/lua/flagnanstest.cpp
+++ b/test/lua/flagnanstest.cpp
@@ -7,7 +7,7 @@
 
 #include "../../algorithms/testsetgenerator.h"
 
-using namespace aocommon;
+using aocommon::Polarization;
 
 BOOST_AUTO_TEST_SUITE(lua_flagnans, *boost::unit_test::label("lua"))
 
diff --git a/util/numberparser.h b/util/numberparser.h
index 73d38d1feeb92d52dba3f571200e4220183821e1..875e59b87c013ba625ef091a69f038d54dc4008b 100644
--- a/util/numberparser.h
+++ b/util/numberparser.h
@@ -47,8 +47,9 @@ class NumberParser {
     } else if (isPositiveSymbol(*str)) {
       isNegative = false;
       ++str;
-    } else
+    } else {
       isNegative = false;
+    }
 
     // Read everything before decimal point
     if (!isDigit(*str))
@@ -111,8 +112,9 @@ class NumberParser {
     } else if (isPositiveSymbol(*str)) {
       isNegative = false;
       ++str;
-    } else
+    } else {
       isNegative = false;
+    }
 
     // Read digits
     if (!isDigit(*str))
@@ -132,9 +134,10 @@ class NumberParser {
         return -val;
       else
         return val;
-    } else
+    } else {
       throw NumberParsingException(
           "The integer contains invalid characters after its digits");
+    }
   }
 
   static double intPow10(int par) {
diff --git a/util/process.h b/util/process.h
index 4d162b3166a243514cd814995ef9155a1d6d2b54..6c018c2a04d78d85640e917913b4855ae5211951 100644
--- a/util/process.h
+++ b/util/process.h
@@ -7,7 +7,7 @@
 
 class Process {
  public:
-  Process(const std::string& cmdLine) {
+  explicit Process(const std::string& cmdLine) {
     _pid = vfork();
     switch (_pid) {
       case -1:  // Error