#!/bin/bash


echo "running cppcheck --enable=all on ./Source/ with filters"

# supress warnings for 'unused' event handlers
#     so that we can exclude the JUCE library from cppcheck
cppcheck --enable=all --template=gcc --quiet -i Source/Trace Source/ 2>                                >(
  grep -v "Cppcheck cannot find all the include files"                                  |
  grep -v "The function 'initialise' is never used."                                    |
  grep -v "The function 'anotherInstanceStarted' is never used."                        |
  grep -v "The function 'moreThanOneInstanceAllowed' is never used."                    |
  grep -v "The function 'userTriedToCloseWindow' is never used."                        |
  grep -v "The function 'closeButtonPressed' is never used."                            |
  grep -v "The function 'timerCallback' is never used."                                 |
  grep -v "The function 'getApplicationName' is never used."                            |
  grep -v "The function 'getApplicationVersion' is never used."                         |
  grep -v "The function 'resized' is never used."                                       |
  grep -v "The function 'paint' is never used."                                         |
  grep -v "The function 'run' is never used."                                           |
  grep -v "The function 'broughtToFront' is never used."                                |
  grep -v "The function 'mouseDown' is never used."                                     |
  grep -v "The function 'buttonClicked' is never used."                                 |
  grep -v "The function 'comboBoxChanged' is never used."                               |
  grep -v "The function 'sliderValueChanged' is never used."                            |
  grep -v "The function 'textEditorFocusLost' is never used."                           |
  grep -v "The function 'valueTreePropertyChanged' is never used."                      |
  grep -v "The function 'textEditorReturnKeyPressed' is never used."                    |
  grep -v "The function 'valueTreeChildAdded' is never used."                           |
  grep -v "The function 'valueTreeChildRemoved' is never used."                         |
  grep -v "The function 'textEditorTextChanged' is never used."                         |
  grep -v "has a constructor with 1 argument that is not explicit."                     )
