magic.py 871 B

123456789101112131415161718192021222324252627
  1. #
  2. # Metrix++, Copyright 2009-2019, Metrix++ Project
  3. # Link: https://github.com/metrixplusplus/metrixplusplus
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. import mpp.api
  8. class Plugin(mpp.api.Plugin,
  9. # make this instance configurable...
  10. mpp.api.IConfigurable):
  11. # ... and implement 2 interfaces
  12. def declare_configuration(self, parser):
  13. parser.add_option("--myext.magic.numbers", "--mmn",
  14. action="store_true", default=False,
  15. help="Enables collection of magic numbers metric [default: %default]")
  16. def configure(self, options):
  17. self.is_active_numbers = options.__dict__['myext.magic.numbers']
  18. def initialize(self):
  19. # use configuration option here
  20. if self.is_active_numbers == True:
  21. print "Hello world"