]> source.dussan.org Git - sonarqube.git/commit
SONAR-1922 Add a kind of version control for quality profiles
authorEvgeny Mandrikov <mandrikov@gmail.com>
Thu, 26 May 2011 22:07:33 +0000 (02:07 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Thu, 26 May 2011 22:54:10 +0000 (02:54 +0400)
commit2dbed652688d87b303f7821ea619ed36ba654a19
treecbf627ca9957741a70eb4dc55ca6210974986b32
parent880d215a9fbafec25f7d6172b22e8dd0915a0c9a
SONAR-1922 Add a kind of version control for quality profiles

Apply patch, which was contributed by Julien Henry:

* Following algorithm was implemented: Every profile starts with
  version=1 and used=false. As soon as there is an analysis of a
  project, the involved profile is set to used=true. Every modification
  to a quality profile (activation, deactivation or modification of
  rule) is logged in DB in dedicated tables. When a modification is done
  on a profile that is used=true, then version number is increased and
  profile is set to used=false.

* Introduced new metric to store profile version, which was used during
  analysis.

* If profile for project is different than the one used during previous
  analysis, then event would be created.

* Introduced new tab 'changelog' for profiles.

Following fixes were applied on original patch:

* Index name limited to 30 characters in Oracle DB, so names were
  reduced.

* Field ActiveRuleChange.profileVersion never read locally, because
  ruby read it directly from DB, so getter added.

* Direction doesn't make sense for 'profile_version' metric, so was
  removed.

* Fixed ProfileEventsSensor: it seems that TimeMachine not guarantee
  that the order of measures would be the same as in query, so we should
  perform two sequential queries.

* Fixed handling of null values during migration.
63 files changed:
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/CorePlugin.java
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ProfileEventsSensor.java [new file with mode: 0644]
plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/sensors/ProfileSensor.java
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ProfileEventsSensorTest.java [new file with mode: 0644]
plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/ProfileSensorTest.java
sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java
sonar-core/src/main/resources/META-INF/persistence.xml
sonar-core/src/test/java/org/sonar/jpa/test/AbstractDbUnitTestCase.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/Event.java
sonar-plugin-api/src/main/java/org/sonar/api/batch/TimeMachineQuery.java
sonar-plugin-api/src/main/java/org/sonar/api/measures/CoreMetrics.java
sonar-plugin-api/src/main/java/org/sonar/api/profiles/RulesProfile.java
sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleChange.java [new file with mode: 0644]
sonar-plugin-api/src/main/java/org/sonar/api/rules/ActiveRuleParamChange.java [new file with mode: 0644]
sonar-plugin-api/src/test/java/org/sonar/api/profiles/RulesProfileTest.java
sonar-server/src/main/java/org/sonar/server/configuration/ProfilesBackup.java
sonar-server/src/main/java/org/sonar/server/configuration/ProfilesManager.java
sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java
sonar-server/src/main/webapp/WEB-INF/app/controllers/profiles_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/rules_configuration_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_change.rb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/models/active_rule_param_change.rb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/models/event_category.rb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/_tabs.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/changelog.html.erb [new file with mode: 0644]
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/index.html.erb
sonar-server/src/main/webapp/WEB-INF/db/migrate/202_create_rule_changes.rb [new file with mode: 0644]
sonar-server/src/test/java/org/sonar/server/configuration/InheritedProfilesTest.java
sonar-server/src/test/java/org/sonar/server/configuration/RuleChangeTest.java [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/BackupTest/backup-valid.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldActivateInChildren.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldChangeParent.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldCheckCycles.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldDeactivateInChildren.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldNotDeleteInheritedProfile-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRemoveParent.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldRenameInheritedProfile-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent-result.xml
sonar-server/src/test/resources/org/sonar/server/configuration/InheritedProfilesTest/shouldSetParent.xml
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/changeParentProfile.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/initialData.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleActivated-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleDeactivated-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleParamChanged-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleReverted.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/ruleSeverityChanged-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsed-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/configuration/RuleChangeTest/versionIncreaseIfUsedAndInChildren-result.xml [new file with mode: 0644]
sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages-result.xml
sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldDisableProfilesWithMissingLanguages.xml
sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages-result.xml
sonar-server/src/test/resources/org/sonar/server/startup/EnableProfilesTest/shouldEnableProfilesWithKnownLanguages.xml
sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts-result.xml
sonar-server/src/test/resources/org/sonar/server/startup/RegisterMetricsTest/cleanAlerts.xml
sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRuleParameters.xml
sonar-server/src/test/resources/org/sonar/server/startup/RegisterRulesTest/disableDeprecatedActiveRules.xml
sonar-testing-harness/src/main/resources/org/sonar/test/persistence/sonar-test.ddl