magic.py 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #
  2. # Metrix++, Copyright 2009-2013, Metrix++ Project
  3. # Link: http://metrixplusplus.sourceforge.net
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. # Metrix++ is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Metrix++ is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. import mpp.api
  20. class Plugin(mpp.api.Plugin,
  21. # make this instance configurable...
  22. mpp.api.IConfigurable):
  23. # ... and implement 2 interfaces
  24. def declare_configuration(self, parser):
  25. parser.add_option("--myext.magic.numbers", "--mmn",
  26. action="store_true", default=False,
  27. help="Enables collection of magic numbers metric [default: %default]")
  28. def configure(self, options):
  29. self.is_active_numbers = options.__dict__['myext.magic.numbers']
  30. def initialize(self):
  31. # use configuration option here
  32. if self.is_active_numbers == True:
  33. print "Hello world"