name: 'coding-rules/show-app'
out: '<%= pkg.assets %>build/js/coding-rules/show-app.js'
- codingRulesOld: options:
- name: 'coding-rules-old/app'
- out: '<%= pkg.assets %>build/js/coding-rules-old/app.js'
-
issues: options:
name: 'issues/app-new'
out: '<%= pkg.assets %>build/js/issues/app-new.js'
'<%= pkg.sources %>hbs/common/**/*.hbs'
'<%= pkg.sources %>hbs/coding-rules/**/*.hbs'
]
- '<%= pkg.assets %>js/templates/coding-rules-old.js': [
- '<%= pkg.sources %>hbs/common/**/*.hbs'
- '<%= pkg.sources %>hbs/coding-rules-old/**/*.hbs'
- ]
'<%= pkg.assets %>js/templates/quality-gates.js': [
'<%= pkg.sources %>hbs/quality-gates/**/*.hbs'
]
+++ /dev/null
-requirejs.config
- baseUrl: "#{baseUrl}/js"
-
- paths:
- 'backbone': 'third-party/backbone'
- 'backbone.marionette': 'third-party/backbone.marionette'
- 'handlebars': 'third-party/handlebars'
-
- shim:
- 'backbone.marionette':
- deps: ['backbone']
- exports: 'Marionette'
- 'backbone':
- exports: 'Backbone'
- 'handlebars':
- exports: 'Handlebars'
-
-
-requirejs [
- 'backbone', 'backbone.marionette',
-
- 'coding-rules-old/layout',
- 'coding-rules-old/router',
-
- # views
- 'coding-rules-old/views/header-view',
- 'coding-rules-old/views/actions-view',
- 'coding-rules-old/views/filter-bar-view',
- 'coding-rules-old/views/coding-rules-list-view',
- 'coding-rules-old/views/coding-rules-detail-view',
- 'coding-rules-old/views/coding-rules-bulk-change-view',
- 'coding-rules-old/views/coding-rules-quality-profile-activation-view',
- 'coding-rules-old/views/coding-rules-bulk-change-dropdown-view',
- 'coding-rules-old/views/coding-rules-facets-view',
- 'coding-rules-old/views/coding-rules-custom-rule-creation-view',
- 'coding-rules-old/views/coding-rules-manual-rule-creation-view',
-
- # filters
- 'navigator/filters/base-filters',
- 'navigator/filters/choice-filters',
- 'navigator/filters/string-filters',
- 'navigator/filters/date-filter-view',
- 'navigator/filters/read-only-filters',
- 'coding-rules-old/views/filters/query-filter-view',
- 'coding-rules-old/views/filters/quality-profile-filter-view',
- 'coding-rules-old/views/filters/inheritance-filter-view',
- 'coding-rules-old/views/filters/active-severities-filter-view',
- 'coding-rules-old/views/filters/activation-filter-view',
- 'coding-rules-old/views/filters/characteristic-filter-view',
- 'coding-rules-old/views/filters/repository-filter-view',
- 'coding-rules-old/views/filters/tag-filter-view',
- 'coding-rules-old/views/filters/language-filter-view',
-
- 'common/handlebars-extensions'
-], (
- Backbone, Marionette,
-
- CodingRulesLayout,
- CodingRulesRouter,
-
- # views
- CodingRulesHeaderView,
- CodingRulesActionsView,
- CodingRulesFilterBarView,
- CodingRulesListView,
- CodingRulesDetailView,
- CodingRulesBulkChangeView,
- CodingRulesQualityProfileActivationView,
- CodingRulesBulkChangeDropdownView,
- CodingRulesFacetsView,
- CodingRulesCustomRuleCreationView,
- CodingRulesManualRuleCreationView,
-
- # filters
- BaseFilters,
- ChoiceFilters,
- StringFilterView,
- DateFilterView,
- ReadOnlyFilterView,
- QueryFilterView,
- QualityProfileFilterView,
- InheritanceFilterView,
- ActiveSeveritiesFilterView,
- ActivationFilterView,
- CharacteristicFilterView,
- RepositoryFilterView,
- TagFilterView,
- LanguageFilterView
-) ->
-
- # Create a generic error handler for ajax requests
- jQuery.ajaxSetup
- error: (jqXHR) ->
- text = jqXHR.responseText
- errorBox = jQuery('.modal-error')
- if jqXHR.responseJSON?.errors?
- text = _.pluck(jqXHR.responseJSON.errors, 'msg').join '. '
- else
- text = t 'default_error_message'
- if errorBox.length > 0
- errorBox.show().text text
- else
- alert text
-
-
- # Add html class to mark the page as navigator page
- jQuery('html').addClass('navigator-page coding-rules-page');
-
-
- # Create an Application
- App = new Marionette.Application
-
-
- App.getQuery = ->
- @filterBarView.getQuery()
-
-
- App.restoreSorting = (params) ->
- sort = _.findWhere(params, key: 'sort')
- asc = _.findWhere(params, key: 'asc')
-
- if (sort && asc)
- @codingRules.sorting =
- sort: sort.value
- asc: asc.value =='true'
-
-
- App.restoreDefaultSorting = ->
- params = []
- params.push(key: 'sort', value: 'createdAt')
- params.push(key: 'asc', value: false)
- @restoreSorting params
-
-
- App.storeQuery = (query, sorting) ->
- if sorting && sorting.sort
- _.extend query,
- s: sorting.sort
- asc: '' + sorting.asc
- queryString = _.map query, (v, k) -> "#{k}=#{encodeURIComponent(v)}"
- @router.navigate queryString.join('|'), replace: true
-
-
-
- App.fetchList = (firstPage) ->
- query = @getQuery()
-
- fetchQuery = _.extend { p: @pageIndex, ps: 25, facets: firstPage }, query
-
- if @codingRules.sorting && @codingRules.sorting.sort
- _.extend fetchQuery,
- s: @codingRules.sorting.sort,
- asc: @codingRules.sorting.asc
-
- @storeQuery query, @codingRules.sorting
-
- # Optimize requested fields
- _.extend fetchQuery, f: 'name,lang,status,tags,sysTags'
-
- if @codingRulesListView
- scrollOffset = jQuery('.navigator-results')[0].scrollTop
- else
- scrollOffset = 0
-
- @layout.showSpinner 'resultsRegion'
- @layout.showSpinner 'facetsRegion' if firstPage
-
-
- jQuery.ajax
- url: "#{baseUrl}/api/rules/search"
- data: fetchQuery
- .done (r) =>
- _.map(r.rules, (rule) ->
- rule.language = App.languages[rule.lang]
- )
-
- @codingRules.paging =
- total: r.total
- pageIndex: r.p
- pageSize: r.ps
- pages: 1 + (r.total / r.ps)
-
- if @codingRulesListView
- @codingRulesListView.close()
-
- if firstPage
- @codingRules.reset r.rules
- @codingRulesListView = new CodingRulesListView
- app: @
- collection: @codingRules
- else
- @codingRulesListView.unbindEvents()
- @codingRules.add r.rules
-
- @layout.resultsRegion.show @codingRulesListView
-
-
- if @codingRules.isEmpty()
- @layout.detailsRegion.reset()
- else if firstPage
- @codingRulesListView.selectFirst()
- else
- @codingRulesListView.selectCurrent()
-
- if firstPage
- @codingRulesFacetsView = new CodingRulesFacetsView
- app: @
- collection: new Backbone.Collection r.facets, comparator: 'property'
- @layout.facetsRegion.show @codingRulesFacetsView
- @filterBarView.restoreFromWsQuery query
- @codingRulesFacetsView.restoreFromQuery query
- else
- jQuery('.navigator-results')[0].scrollTop = scrollOffset
-
- @layout.onResize()
-
-
-
- App.facetLabel = (property, value) ->
- return value unless App.facetPropertyToLabels[property]
- App.facetPropertyToLabels[property](value)
-
-
- App.fetchFirstPage = ->
- @pageIndex = 1
- App.fetchList true
-
-
- App.fetchNextPage = ->
- if @pageIndex < @codingRules.paging.pages
- @pageIndex++
- App.fetchList false
-
-
- App.getQualityProfile = ->
- value = @qualityProfileFilter.get('value')
- if value? && value.length == 1 then value[0] else null
-
-
- App.getQualityProfilesForLanguage = (language_key) ->
- _.filter App.qualityProfiles, (p) => p.lang == language_key
-
- App.getQualityProfileByKey = (profile_key) ->
- _.findWhere App.qualityProfiles, key: profile_key
-
-
- App.getSubcharacteristicName = (name) ->
- (App.characteristics[name] || '').replace ': ', ' > '
-
-
- App.showRule = (ruleKey) ->
- App.layout.showSpinner 'detailsRegion'
- jQuery.ajax
- url: "#{baseUrl}/api/rules/show"
- data:
- key: ruleKey
- actives: true
- .done (r) =>
- rule = new Backbone.Model(r.rule)
- App.codingRulesQualityProfileActivationView.rule = rule
- App.detailView = new CodingRulesDetailView
- app: App
- model: rule
- actives: r.actives
- App.layout.detailsRegion.show App.detailView
-
-
- App.manualRepository = ->
- key: 'manual'
- name: 'Manual Rules'
- language: 'none'
-
-
- App.createManualRule = ->
- App.codingRulesManualRuleCreationView.model = new Backbone.Model()
- App.codingRulesManualRuleCreationView.show()
-
-
- # Construct layout
- App.addInitializer ->
- @layout = new CodingRulesLayout app: @
- jQuery('#content').append @layout.render().el
- @layout.onResize()
-
-
- # Construct header
- App.addInitializer ->
- @codingRulesHeaderView = new CodingRulesHeaderView app: @
- @layout.headerRegion.show @codingRulesHeaderView
-
-
- # Define coding rules
- App.addInitializer ->
- @codingRules = new Backbone.Collection
- @restoreDefaultSorting()
-
-
- # Construct status bar
- App.addInitializer ->
- @codingRulesActionsView = new CodingRulesActionsView
- app: @
- collection: @codingRules
- @layout.actionsRegion.show @codingRulesActionsView
-
-
- # Construct bulk change views
- App.addInitializer ->
- @codingRulesBulkChangeView = new CodingRulesBulkChangeView app: @
- @codingRulesBulkChangeDropdownView = new CodingRulesBulkChangeDropdownView app: @
-
-
- # Construct quality profile activation view
- App.addInitializer ->
- @codingRulesQualityProfileActivationView = new CodingRulesQualityProfileActivationView app: @
-
-
- # Construct custom rule creation view
- App.addInitializer ->
- @codingRulesCustomRuleCreationView = new CodingRulesCustomRuleCreationView app: @
-
-
- # Construct custom rule creation view
- App.addInitializer ->
- @codingRulesManualRuleCreationView = new CodingRulesManualRuleCreationView app: @
-
- # Define filters
- App.addInitializer ->
- @filters = new BaseFilters.Filters
-
- @queryFilter = new BaseFilters.Filter
- property: 'q'
- type: QueryFilterView
- size: 50
- @filters.add @queryFilter
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.severity'
- property: 'severities'
- type: ChoiceFilters.ChoiceFilterView
- optional: true
- choices:
- 'BLOCKER': t 'severity.BLOCKER'
- 'CRITICAL': t 'severity.CRITICAL'
- 'MAJOR': t 'severity.MAJOR'
- 'MINOR': t 'severity.MINOR'
- 'INFO': t 'severity.INFO'
- choiceIcons:
- 'BLOCKER': 'severity-blocker'
- 'CRITICAL': 'severity-critical'
- 'MAJOR': 'severity-major'
- 'MINOR': 'severity-minor'
- 'INFO': 'severity-info'
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.tag'
- property: 'tags'
- type: TagFilterView
- optional: true
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.characteristic'
- property: 'debt_characteristics'
- type: CharacteristicFilterView
- choices: @characteristics
- multiple: false
- optional: true
-
- @qualityProfileFilter = new BaseFilters.Filter
- name: t 'coding_rules.filters.quality_profile'
- property: 'qprofile'
- type: QualityProfileFilterView
- app: @
- choices: @qualityProfiles
- multiple: false
- @filters.add @qualityProfileFilter
-
- @activationFilter = new BaseFilters.Filter
- name: t 'coding_rules.filters.activation'
- property: 'activation'
- type: ActivationFilterView
- enabled: false
- optional: true
- multiple: false
- qualityProfileFilter: @qualityProfileFilter
- choices:
- true: t 'coding_rules.filters.activation.active'
- false: t 'coding_rules.filters.activation.inactive'
- @filters.add @activationFilter
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.active_severity'
- property: 'active_severities'
- type: ActiveSeveritiesFilterView
- enabled: false
- optional: true
- qualityProfileFilter: @qualityProfileFilter
- choices:
- 'BLOCKER': t 'severity.BLOCKER'
- 'CRITICAL': t 'severity.CRITICAL'
- 'MAJOR': t 'severity.MAJOR'
- 'MINOR': t 'severity.MINOR'
- 'INFO': t 'severity.INFO'
- choiceIcons:
- 'BLOCKER': 'severity-blocker'
- 'CRITICAL': 'severity-critical'
- 'MAJOR': 'severity-major'
- 'MINOR': 'severity-minor'
- 'INFO': 'severity-info'
-
- @languageFilter = new BaseFilters.Filter
- name: t 'coding_rules.filters.language'
- property: 'languages'
- type: LanguageFilterView
- app: @
- choices: @languages
- optional: true
- @filters.add @languageFilter
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.availableSince'
- property: 'available_since'
- type: DateFilterView
- enabled: false
- optional: true
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.inheritance'
- property: 'inheritance'
- type: InheritanceFilterView
- enabled: false
- optional: true
- multiple: false
- qualityProfileFilter: @qualityProfileFilter
- choices:
- 'NONE': t 'coding_rules.filters.inheritance.not_inherited'
- 'INHERITED': t 'coding_rules.filters.inheritance.inherited'
- 'OVERRIDES': t 'coding_rules.filters.inheritance.overriden'
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.repository'
- property: 'repositories'
- type: RepositoryFilterView
- enabled: false
- optional: true
- app: @
- choices: @repositories
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.status'
- property: 'statuses'
- type: ChoiceFilters.ChoiceFilterView
- enabled: false
- optional: true
- choices: @statuses
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.template'
- property: 'is_template'
- type: ChoiceFilters.ChoiceFilterView
- optional: true
- multiple: false
- choices:
- 'true': t 'coding_rules.filters.template.is_template'
- 'false': t 'coding_rules.filters.template.is_not_template'
-
- @filters.add new BaseFilters.Filter
- name: t 'coding_rules.filters.key'
- property: 'rule_key'
- type: ReadOnlyFilterView
- enabled: false
- optional: true
-
-
- @filterBarView = new CodingRulesFilterBarView
- app: @
- collection: @filters,
- extra: sort: '', asc: false
- @layout.filtersRegion.show @filterBarView
-
-
- # Start router
- App.addInitializer ->
- @router = new CodingRulesRouter app: @
- Backbone.history.start()
-
-
- # Call app before start the application
- appXHR = jQuery.ajax
- url: "#{baseUrl}/api/rules/app"
- .done (r) ->
- App.appState = new Backbone.Model
- App.state = new Backbone.Model
- App.canWrite = r.canWrite
- App.qualityProfiles = _.sortBy r.qualityprofiles, ['name', 'lang']
- App.languages = _.extend r.languages, none: 'None'
- _.map App.qualityProfiles, (profile) ->
- profile.language = App.languages[profile.lang]
- App.repositories = r.repositories
- App.repositories.push App.manualRepository()
- App.statuses = r.statuses
- App.characteristics = r.characteristics
-
- App.facetPropertyToLabels =
- 'languages': (value) -> App.languages[value]
- 'repositories': (value) ->
- repo = _.findWhere(App.repositories, key: value)
- other_repo_with_same_name = _.find(App.repositories, (repos) -> repos.name == repo.name && repos.key != repo.key)
- if other_repo_with_same_name
- App.languages[repo.language] + ' ' + repo.name
- else
- repo.name
-
- # Message bundles
- l10nXHR = window.requestMessages()
-
- jQuery.when(l10nXHR, appXHR).done ->
- # Remove the initial spinner
- jQuery('#coding-rules-page-loader').remove()
-
- # Start the application
- App.start()
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class AppLayout extends Marionette.Layout
- className: 'navigator coding-rules-navigator'
- template: Templates['coding-rules-layout']
- storageKey: 'codingRulesResultsWidth'
-
-
- regions:
- headerRegion: '.navigator-header'
- actionsRegion: '.navigator-actions'
- resultsRegion: '.navigator-results'
- detailsRegion: '.navigator-details'
- filtersRegion: '.navigator-filters'
- facetsRegion: '.navigator-facets'
-
-
- ui:
- side: '.navigator-side'
- results: '.navigator-results'
- details: '.navigator-details'
- resizer: '.navigator-resizer'
-
-
- initialize: ->
- jQuery(window).on 'resize', => @onResize()
-
- @isResize = false
- jQuery('body').on 'mousemove', (e) => @processResize(e)
- jQuery('body').on 'mouseup', => @stopResize()
-
-
- onRender: ->
- @ui.resizer.on 'mousedown', (e) => @startResize(e)
-
- resultsWidth = localStorage.getItem @storageKey
- if resultsWidth
- @$(@resultsRegion.el).width +resultsWidth
- @ui.side.width +resultsWidth + 20
-
-
- onResize: ->
- footerEl = jQuery('#footer')
- footerHeight = footerEl.outerHeight true
-
- resultsEl = @ui.results
- resultsHeight = jQuery(window).height() - resultsEl.offset().top -
- parseInt(resultsEl.css('margin-bottom'), 10) - footerHeight
- resultsEl.height resultsHeight
-
- detailsEl = @ui.details
- detailsWidth = jQuery(window).width() - detailsEl.offset().left -
- parseInt(detailsEl.css('margin-right'), 10)
- detailsHeight = jQuery(window).height() - detailsEl.offset().top -
- parseInt(detailsEl.css('margin-bottom'), 10) - footerHeight
- detailsEl.width(detailsWidth).height detailsHeight
-
-
- showSpinner: (region) ->
- @[region].show new Marionette.ItemView
- template: _.template('<i class="spinner"></i>')
-
-
- startResize: (e) ->
- @isResize = true
- @originalWidth = @ui.results.width()
- @x = e.clientX
- jQuery('html').attr('unselectable', 'on').css('user-select', 'none').on('selectstart', false)
-
-
- processResize: (e) ->
- if @isResize
- delta = e.clientX - @x
- @$(@resultsRegion.el).width @originalWidth + delta
- @ui.side.width @originalWidth + 20 + delta
- localStorage.setItem @storageKey, @ui.results.width()
- @onResize()
-
-
- stopResize: ->
- if @isResize
- jQuery('html').attr('unselectable', 'off').css('user-select', 'text').off('selectstart')
- @isResize = false
- true
+++ /dev/null
-define ['jquery.mockjax'], ->
-
- jQuery.mockjaxSettings.contentType = 'text/json';
- jQuery.mockjaxSettings.responseTime = 250;
-
- # GET /api/codingrules/app
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/app"
- responseText: JSON.stringify
- qualityprofiles: [
- { key: 'sonarway', name: 'Sonar Way', lang: 'Java', parent: null },
- { key: 'qualityprofile1', name: 'Quality Profile 1', lang: 'Java', parent: 'sonarway' },
- { key: 'qualityprofile2', name: 'Quality Profile 2', lang: 'JavaScript', parent: 'sonarway' },
- { key: 'qualityprofile3', name: 'Quality Profile 3', lang: 'Java', parent: null },
- ]
- languages:
- java: 'Java'
- javascript: 'JavaScript'
- repositories:
- 'checkstyle': 'Checkstyle'
- 'common-java': 'Common SonarQube'
- 'findbugs': 'FindBugs'
- 'pmd': 'PMD'
- 'pmd-unit-tests': 'PMD Unit Tests'
- 'squid': 'SonarQube'
- statuses:
- 'BETA': 'Beta'
- 'DEPRECATED': 'Deprecated'
- 'READY': 'Ready'
- tags:
- 'brain-overload': 'brain-overload'
- 'bug': 'bug'
- 'comment': 'comment'
- 'convention': 'convention'
- 'error-handling': 'error-handling'
- 'formatting': 'formatting'
- 'java8': 'java8'
- 'multithreading': 'multithreading'
- 'naming': 'naming'
- 'pitfall': 'pitfall'
- 'security': 'security'
- 'size': 'size'
- 'unused': 'unused'
- 'unused-code': 'unused-code'
- characteristics:
- '1469': 'Changeability'
- '1441': 'Changeability: Architecture related changeability'
- '1470': 'Changeability: Data related changeability'
- '1475': 'Changeability: Logic related changeability'
- '1392': 'Efficiency'
- '1377': 'Efficiency: Memory use'
- '2965': 'Efficiency: Network use'
- '1393': 'Efficiency: Processor use'
- '1154': 'Maintainability'
- '1022': 'Maintainability: Readability'
- '1155': 'Maintainability: Understandability'
- '988': 'Portability'
- '977': 'Portability: Compiler related portability'
- '989': 'Portability: Hardware related portability'
- '994': 'Portability: Language related portability'
- '1000': 'Portability: OS related portability'
- '1006': 'Portability: Software related portability'
- '1021': 'Portability: Time zone related portability'
- '1551': 'Reliability'
- '1496': 'Reliability: Architecture related reliability'
- '1552': 'Reliability: Data related reliability'
- '1596': 'Reliability: Exception handling'
- '1622': 'Reliability: Fault tolerance'
- '1629': 'Reliability: Instruction related reliability'
- '1759': 'Reliability: Logic related reliability'
- '2948': 'Reliability: Resource'
- '1874': 'Reliability: Synchronization related reliability'
- '1925': 'Reliability: Unit tests'
- '975': 'Reusability'
- '974': 'Reusability: Modularity'
- '976': 'Reusability: Transportability'
- '1345': 'Security'
- '1335': 'Security: API abuse'
- '1346': 'Security: Errors'
- '1349': 'Security: Input validation and representation'
- '1364': 'Security: Security features'
- '1933': 'Testability'
- '1932': 'Testability: Integration level testability'
- '1934': 'Testability: Unit level testability'
- messages:
- 'all': 'All'
- 'any': 'Any'
- 'apply': 'Apply'
- 'are_you_sure': 'Are you sure?'
- 'bold': 'Bold'
- 'bulk_change': 'Bulk Change'
- 'bulleted_point': 'Bulleted point'
- 'cancel': 'Cancel'
- 'change': 'Change'
- 'code': 'Code'
- 'delete': 'Delete'
- 'done': 'Done'
- 'edit': 'Edit'
- 'markdown.helplink': 'Markdown Help'
- 'moreCriteria': '+ More Criteria'
- 'save': 'Save'
- 'search_verb': 'Search'
- 'severity': 'Severity'
- 'update': 'Update'
-
- 'severity.BLOCKER': 'Blocker'
- 'severity.CRITICAL': 'Critical'
- 'severity.MAJOR': 'Major'
- 'severity.MINOR': 'Minor'
- 'severity.INFO': 'Info'
-
- 'coding_rules.activate': 'Activate'
- 'coding_rules.activate_in': 'Activate In'
- 'coding_rules.activate_in_quality_profile': 'Activate In Quality Profile'
- 'coding_rules.activate_in_all_quality_profiles': 'Activate In All {0} Profiles'
- 'coding_rules.add_note': 'Add Note'
- 'coding_rules.available_since': 'Available Since'
- 'coding_rules.bulk_change': 'Bulk Change'
- 'coding_rules.change_severity': 'Change Severity'
- 'coding_rules.change_severity_in': 'Change Severity In'
- 'coding_rules.change_details': 'Change Details of Quality Profile'
- 'coding_rules.extend_description': 'Extend Description'
- 'coding_rules.deactivate_in': 'Deactivate In'
- 'coding_rules.deactivate': 'Deactivate'
- 'coding_rules.deactivate_in_quality_profile': 'Deactivate In Quality Profile'
- 'coding_rules.deactivate_in_all_quality_profiles': 'Deactivate In All {0} Profiles'
- 'coding_rules.found': 'Found'
- 'coding_rules.inherits': '"{0}" inherits "{1}"'
- 'coding_rules.key': 'Key:'
- 'coding_rules.new_search': 'New Search'
- 'coding_rules.no_results': 'No Coding Rules'
- 'coding_rules.no_tags': 'No tags'
- 'coding_rules.order': 'Order'
- 'coding_rules.ordered_by': 'Ordered By'
- 'coding_rules.original': 'Original:'
- 'coding_rules.page': 'Coding Rules'
- 'coding_rules.parameters': 'Parameters'
- 'coding_rules.parameters.default_value': 'Default Value:'
- 'coding_rules.permalink': 'Permalink'
- 'coding_rules.quality_profiles': 'Quality Profiles'
- 'coding_rules.quality_profile': 'Quality Profile'
- 'coding_rules.repository': 'Repository:'
- 'coding_rules.revert_to_parent_definition': 'Revert to Parent Definition'
- 'coding_rules._rules': 'rules'
- 'coding_rules.select_tag': 'Select Tag'
-
- 'coding_rules.filters.activation': 'Activation'
- 'coding_rules.filters.activation.active': 'Active'
- 'coding_rules.filters.activation.inactive': 'Inactive'
- 'coding_rules.filters.activation.help': 'Activation criterion is available when a quality profile is selected'
- 'coding_rules.filters.availableSince': 'Available Since'
- 'coding_rules.filters.characteristic': 'Characteristic'
- 'coding_rules.filters.description': 'Description'
- 'coding_rules.filters.quality_profile': 'Quality Profile'
- 'coding_rules.filters.inheritance': 'Inheritance'
- 'coding_rules.filters.inheritance.inactive': 'Inheritance criterion is available when an inherited quality profile is selected'
- 'coding_rules.filters.inheritance.not_inherited': 'Not Inherited'
- 'coding_rules.filters.inheritance.inherited': 'Inherited'
- 'coding_rules.filters.inheritance.overriden': 'Overriden'
- 'coding_rules.filters.key': 'Key'
- 'coding_rules.filters.language': 'Language'
- 'coding_rules.filters.name': 'Name'
- 'coding_rules.filters.repository': 'Repository'
- 'coding_rules.filters.severity': 'Severity'
- 'coding_rules.filters.status': 'Status'
- 'coding_rules.filters.tag': 'Tag'
-
- 'coding_rules.sort.creation_date': 'Creation Date'
- 'coding_rules.sort.name': 'Name'
-
-
- # GET /api/codingrules/search
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/search"
- responseText: JSON.stringify
- codingrules: [
- {
- name: 'Array designators "[]" should be located after the type in method signatures'
- language: 'Java'
- severity: 'MAJOR'
- status: 'DEPRECATED'
- },
- {
- name: 'Avoid Array Loops'
- language: 'Java'
- severity: 'CRITICAL'
- status: 'READY'
- },
- {
- name: 'Bad practice - Abstract class defines covariant compareTo() method'
- language: 'Java'
- severity: 'MAJOR'
- status: 'READY'
- },
- {
- name: 'Correctness - Use of class without a hashCode() method in a hashed data structure'
- language: 'Java'
- severity: 'MINOR'
- status: 'BETA'
- },
- {
- name: 'Useless Operation On Immutable'
- language: 'Java'
- severity: 'MAJOR'
- status: 'READY'
- }
- ]
- paging:
- total: 5
- fTotal: '5'
- facets: [
- {
- name: 'Languages'
- property: 'languages'
- values: [
- { key: 'java', text: 'Java', stat: 45 }
- { key: 'javascript', text: 'JavaScript', stat: 21 }
- ]
- }
- {
- name: 'Tags'
- property: 'tags'
- values: [
- { key: 'brain-overload', text: 'brain-overload', stat: 8 }
- { key: 'bug', text: 'bug', stat: 7 }
- { key: 'comment', text: 'comment', stat: 7 }
- { key: 'convention', text: 'convention', stat: 6 }
- { key: 'error-handling', text: 'error-handling', stat: 5 }
- ]
- }
- {
- name: 'Repositories'
- property: 'repositories'
- values: [
- { key: 'squid', text: 'SonarQube', stat: 57 }
- { key: 'pmd', text: 'PMD', stat: 17 }
- ]
- }
- ]
-
-
-
-
- # GET /api/codingrules/show
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/show"
- responseText: JSON.stringify
- codingrule:
- name: 'Array designators "[]" should be located after the type in method signatures'
- language: 'Java'
- creationDate: '2013-10-15'
- fCreationDate: 'Oct 15, 2013'
- status: 'DEPRECATED'
- repositoryName: 'SonarQube'
- repositoryKey: 'squid'
- characteristic: 'Reliability'
- subcharacteristic: 'Data related reliability'
- key: 'S1190'
- parameters: [
- { key: 'someParameter', type: 'INT', default: 4, description: 'Some parameter description' }
- { key: 'xpath', type: 'TEXT', description: 'XPath, the XML Path Language, is a query language for selecting nodes from an XML document. In addition, XPath may be used to compute values (e.g., strings, numbers, or Boolean values) from the content of an XML document. XPath was defined by the World Wide Web Consortium (W3C).' }
- ]
- description: '''
- <p>
- According to the Java Language Specification:
- </p>
-
- <pre>For compatibility with older versions of the Java SE platform,
- the declaration of a method that returns an array is allowed to place (some or all of)
- the empty bracket pairs that form the declaration of the array type after
- the formal parameter list. This obsolescent syntax should not be used in new code.
- </pre>
-
- <p>The following code snippet illustrates this rule:</p>
-
- <pre>public int getVector()[] { /* ... */ } // Non-Compliant
-
- public int[] getVector() { /* ... */ } // Compliant
-
- public int[] getMatrix()[] { /* ... */ } // Non-Compliant
-
- public int[][] getMatrix() { /* ... */ } // Compliant
- </pre>'''
- extra: '''This note is here <b>only for test purposes</b>.'''
- extraRaw: '''This note is here *only for test purposes*.'''
-
- qualityProfiles: [
- {
- name: 'SonarWay'
- key: 'sonarway'
- severity: 'MINOR'
- parameters: [
- { key: 'someParameter', value: 8 }
- { key: 'xpath', value: '/child::html/child::body/child::*/child::span[attribute::class]' }
- ]
- },
- {
- name: 'Quality Profile 1'
- key: 'qualityprofile1'
- severity: 'MAJOR'
- parameters: [
- { key: 'someParameter', value: 6 }
- { key: 'xpath', value: '/html/body/*/span[@class]' }
- ]
- inherits: 'sonarway'
- }
- ]
-
-
-
- # POST /api/codingrules/extend_description
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/extend_description"
- responseText: JSON.stringify
- extra: '''This note is here <i>only for test purposes</i>.'''
- extraRaw: '''This note is here *only for test purposes*.'''
-
-
- # POST /api/codingrules/bulk_change
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/bulk_change"
-
-
- # POST /api/codingrules/set_tags
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/set_tags"
-
-
- # POST /api/codingrules/activate
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/activate"
-
-
- # POST /api/codingrules/note
- jQuery.mockjax
- url: "#{baseUrl}/api/codingrules/note"
- responseText: JSON.stringify
- note:
- username: 'Admin Admin'
- html: '''<p>This note is here <b>only for test purposes</b>.</p>'''
- raw: '''This note is here *only for test purposes*.'''
- fCreationDate: 'less than a minute'
-
-
- # GET /api/qualityprofiles/list
- jQuery.mockjax
- url: "#{baseUrl}/api/qualityprofiles/list"
- responseText: JSON.stringify
- more: false
- results: [
- { id: 'sonarway', text: 'Sonar Way', category: 'Java', parent: null },
- { id: 'qp1', text: 'Quality Profile 1', category: 'Java', parent: 'sonarway' },
- { id: 'qp2', text: 'Quality Profile 2', category: 'JavaScript', parent: 'sonarway' },
- { id: 'qp3', text: 'Quality Profile 3', category: 'Java', parent: null },
- ]
-
-
- # GET /api/qualityprofiles/show
- jQuery.mockjax
- url: "#{baseUrl}/api/qualityprofiles/show"
- responseText: JSON.stringify
- qualityprofile:
- id: 'sonarway', text: 'Sonar Way', category: 'Java', parent: null
-
+++ /dev/null
-define [
- 'backbone',
-], (
- Backbone,
-) ->
-
- class AppRouter extends Backbone.Router
-
- routes:
- '': 'emptyQuery'
- ':query': 'index'
-
-
- initialize: (options) ->
- @app = options.app
-
-
- parseQuery: (query, separator) ->
- (query || '').split(separator || '|').map (t) ->
- tokens = t.split('=')
- key: tokens[0], value: decodeURIComponent(tokens[1])
-
-
- emptyQuery: ->
- @app.restoreDefaultSorting()
- @index('')
-
-
- index: (query) ->
- params = this.parseQuery(query)
- @loadResults(params)
-
-
- loadResults: (params) ->
- @app.filterBarView.restoreFromQuery(params)
- if @app.codingRulesFacetsView
- @app.codingRulesFacetsView.restoreFromQuery(params)
- @app.restoreSorting(params)
- @app.fetchFirstPage()
+++ /dev/null
-define [
- 'backbone.marionette'
- 'templates/coding-rules-old'
-], (
- Marionette
- Templates
-) ->
-
- class CodingRulesStatusView extends Marionette.ItemView
- template: Templates['coding-rules-actions']
-
-
- collectionEvents:
- 'all': 'render'
-
-
- ui:
- orderChoices: '.navigator-actions-order-choices'
- bulkChange: '.navigator-actions-bulk'
-
-
- events:
- 'click .navigator-actions-order': 'toggleOrderChoices'
- 'click @ui.orderChoices': 'sort'
- 'click @ui.bulkChange': 'bulkChange'
-
-
- onRender: ->
- unless @collection.sorting.sortText
- while not @collection.sorting.sortText
- @collection.sorting.sortText = @$('[data-sort=' + @collection.sorting.sort + ']:first').text()
- @render()
-
-
- toggleOrderChoices: (e) ->
- e.stopPropagation()
- @ui.orderChoices.toggleClass 'open'
- if @ui.orderChoices.is '.open'
- jQuery('body').on 'click.coding_rules_actions', =>
- @ui.orderChoices.removeClass 'open'
-
-
- sort: (e) ->
- e.stopPropagation()
- @ui.orderChoices.removeClass 'open'
- jQuery('body').off 'click.coding_rules_actions'
- el = jQuery(e.target)
- sort = el.data 'sort'
- asc = el.data 'asc'
- if sort != null && asc != null
- @collection.sorting = sort: sort, sortText: el.text(), asc: asc
- @options.app.fetchFirstPage()
-
-
- bulkChange: (e) ->
- e.stopPropagation()
- @options.app.codingRulesBulkChangeDropdownView.toggle()
-
-
- serializeData: ->
- _.extend super,
- canWrite: @options.app.canWrite
- paging: @collection.paging
- sorting: @collection.sorting
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesBulkChangeDropdownView extends Marionette.ItemView
- className: 'coding-rules-bulk-change-dropdown'
- template: Templates['coding-rules-bulk-change-dropdown']
-
-
- events:
- 'click .coding-rules-bulk-change-dropdown-link': 'doAction'
-
-
- doAction: (e) ->
- action = jQuery(e.currentTarget).data 'action'
- param = jQuery(e.currentTarget).data 'param'
- @options.app.codingRulesBulkChangeView.show action, param
-
-
- onRender: ->
- jQuery('body').append @el
- jQuery('body').off('click.bulk-change').on 'click.bulk-change', => @hide()
- @$el.css
- top: jQuery('.navigator-actions').offset().top + jQuery('.navigator-actions').height() + 1
- left: jQuery('.navigator-actions').offset().left + jQuery('.navigator-actions').outerWidth() - @$el.outerWidth()
-
-
- toggle: ->
- if @$el.is(':visible') then @hide() else @show()
-
-
- show: ->
- @render()
- @$el.show()
-
-
- hide: ->
- @$el.hide()
-
-
- serializeData: ->
- languages = @options.app.languageFilter.get('value')
- activationValues = @options.app.activationFilter.get('value') or []
- qualityProfile = @options.app.getQualityProfile()
-
- qualityProfile: qualityProfile
- qualityProfileName: @options.app.qualityProfileFilter.view.renderValue()
- singleLanguage: _.isArray(languages) and languages.length == 1
- language: @options.app.languageFilter.view.renderValue()
- allowActivateOnProfile: qualityProfile and (activationValues.length == 0 or activationValues[0] == 'false')
- allowDeactivateOnProfile: qualityProfile and (activationValues.length == 0 or activationValues[0] == 'true')
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesBulkChangeView extends Marionette.ItemView
- template: Templates['coding-rules-bulk-change']
-
- ui:
- modalFooter: '.modal-foot'
- modalError: '.modal-error'
- modalWarning: '.modal-warning'
- modalNotice: '.modal-notice'
- modalField: '.modal-field'
- codingRulesSubmitBulkChange: '#coding-rules-submit-bulk-change'
- codingRulesCancelBulkChange: '#coding-rules-cancel-bulk-change'
- codingRulesCloseBulkChange: '#coding-rules-close-bulk-change'
-
- events:
- 'submit form': 'onSubmit'
- 'click @ui.codingRulesCancelBulkChange': 'hide'
- 'click @ui.codingRulesCloseBulkChange': 'close'
- 'change select': 'enableAction'
-
-
- onRender: ->
- @$el.dialog
- dialogClass: 'no-close',
- width: '600px',
- draggable: false,
- autoOpen: false,
- modal: true,
- minHeight: 50,
- resizable: false,
- title: null
-
- @$('#coding-rules-bulk-change-profile').select2
- width: '250px'
- minimumResultsForSearch: 1
-
- show: (action, param = null) ->
- @action = action
- @profile = param
- @render()
- @$el.dialog 'open'
-
-
- hide: ->
- @$el.dialog 'close'
-
-
- close: ->
- @options.app.fetchFirstPage()
- @hide()
- false
-
-
- prepareQuery: ->
- _.extend @options.app.getQuery(),
- wsAction: @action
- profile_key: @$('#coding-rules-bulk-change-profile').val() or @profile
-
-
- bulkChange: (query) ->
- wsAction = query.wsAction
- query = _.omit(query, 'wsAction')
-
- @ui.modalError.hide()
- @ui.modalWarning.hide()
- @ui.modalNotice.hide()
-
- origFooter = @ui.modalFooter.html()
- @ui.modalFooter.html '<i class="spinner"></i>'
-
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualityprofiles/#{wsAction}_rules"
- data: query
- .done (r) =>
- @ui.modalField.hide()
- if (r.failed)
- @ui.modalWarning.show()
- @ui.modalWarning.html tp('coding_rules.bulk_change.warning', r.succeeded, r.failed)
- else
- @ui.modalNotice.show()
- @ui.modalNotice.html tp('coding_rules.bulk_change.success', r.succeeded)
-
- @ui.modalFooter.html origFooter
- @$(@ui.codingRulesSubmitBulkChange.selector).hide()
- @$(@ui.codingRulesCancelBulkChange.selector).hide()
- @$(@ui.codingRulesCloseBulkChange.selector).show()
- @$(@ui.codingRulesCloseBulkChange.selector).focus()
- .fail =>
- @ui.modalFooter.html origFooter
-
-
- onSubmit: (e) ->
- e.preventDefault()
- @bulkChange(@prepareQuery())
-
-
- getAvailableQualityProfiles: ->
- languages = @options.app.languageFilter.get('value')
- singleLanguage = _.isArray(languages) && languages.length == 1
-
- if singleLanguage
- @options.app.getQualityProfilesForLanguage(languages[0])
- else
- @options.app.qualityProfiles
-
- serializeData: ->
- action: @action
-
- paging: @options.app.codingRules.paging
- qualityProfiles: @options.app.qualityProfiles
-
- qualityProfile: @profile
- qualityProfileName: @options.app.qualityProfileFilter.view.renderValue()
-
- availableQualityProfiles: @getAvailableQualityProfiles()
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesCustomRuleCreationView extends Marionette.ItemView
- className: 'coding-rules-modal'
- template: Templates['coding-rules-custom-rule-creation']
-
-
- ui:
- customRuleCreationKey: '#coding-rules-custom-rule-creation-key'
- customRuleCreationName: '#coding-rules-custom-rule-creation-name'
- customRuleCreationHtmlDescription: '#coding-rules-custom-rule-creation-html-description'
- customRuleCreationSeverity: '#coding-rules-custom-rule-creation-severity'
- customRuleCreationStatus: '#coding-rules-custom-rule-creation-status'
- customRuleCreationParameters: '[name]'
- customRuleCreationCreate: '#coding-rules-custom-rule-creation-create'
- customRuleCreationReactivate: '#coding-rules-custom-rule-creation-reactivate'
- modalFoot: '.modal-foot'
-
-
- events:
- 'input @ui.customRuleCreationName': 'generateKey'
- 'keydown @ui.customRuleCreationName': 'generateKey'
- 'keyup @ui.customRuleCreationName': 'generateKey'
-
- 'input @ui.customRuleCreationKey': 'flagKey'
- 'keydown @ui.customRuleCreationKey': 'flagKey'
- 'keyup @ui.customRuleCreationKey': 'flagKey'
-
- 'click #coding-rules-custom-rule-creation-cancel': 'hide'
- 'click @ui.customRuleCreationCreate': 'create'
- 'click @ui.customRuleCreationReactivate': 'reactivate'
-
-
- generateKey: ->
- unless @keyModifiedByUser
- if @ui.customRuleCreationKey
- generatedKey = @ui.customRuleCreationName.val().latinize().replace(/[^A-Za-z0-9]/g, '_')
- @ui.customRuleCreationKey.val generatedKey
-
- flagKey: ->
- @keyModifiedByUser = true
- # Cannot use @ui.customRuleCreationReactivate.hide() directly since it was not there at initial render
- jQuery(@ui.customRuleCreationReactivate.selector).hide()
-
-
- create: ->
- action = 'create'
- if @model and @model.has 'key'
- action = 'update'
-
- postData =
- name: @ui.customRuleCreationName.val()
- markdown_description: @ui.customRuleCreationHtmlDescription.val()
- severity: @ui.customRuleCreationSeverity.val()
- status: @ui.customRuleCreationStatus.val()
-
- if @model && @model.has 'key'
- postData.key = @model.get 'key'
- else
- postData.template_key = @templateRule.get 'key'
- postData.custom_key = @ui.customRuleCreationKey.val()
- postData.prevent_reactivation = true
-
- params = @ui.customRuleCreationParameters.map(->
- node = jQuery(@)
- value = node.val()
- if !value and action == 'create'
- value = node.prop('placeholder') || ''
- key: node.prop('name'), value: value).get()
-
- postData.params = (params.map (param) -> param.key + '=' + window.csvEscape(param.value)).join(';')
- @sendRequest(action, postData)
-
-
- reactivate: ->
- postData =
- name: @existingRule.name
- markdown_description: @existingRule.mdDesc
- severity: @existingRule.severity
- status: @existingRule.status
- template_key: @existingRule.templateKey
- custom_key: @ui.customRuleCreationKey.val()
- prevent_reactivation: false
-
- params = @existingRule.params
- postData.params = (params.map (param) -> param.key + '=' + param.defaultValue).join(';')
-
- @sendRequest('create', postData)
-
-
- sendRequest: (action, postData) ->
- @$('.modal-error').hide()
- @$('.modal-warning').hide()
-
- origFooter = @ui.modalFoot.html()
- @ui.modalFoot.html '<i class="spinner"></i>'
-
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/" + action
- data: postData
- error: () ->
- .done (r) =>
- delete @templateRule
- @options.app.showRule r.rule.key
- @hide()
- .fail (jqXHR, textStatus, errorThrown) =>
- if jqXHR.status == 409
- @existingRule = jqXHR.responseJSON.rule
- @$('.modal-warning').show()
- @ui.modalFoot.html Templates['coding-rules-custom-rule-reactivation'](@)
- else
- jQuery.ajaxSettings.error(jqXHR, textStatus, errorThrown)
- @ui.modalFoot.html origFooter
-
-
- onRender: ->
- @$el.dialog
- dialogClass: 'no-close',
- width: '600px',
- draggable: false,
- autoOpen: false,
- modal: true,
- minHeight: 50,
- resizable: false,
- title: null
-
- @keyModifiedByUser = false
-
- format = (state) ->
- return state.text unless state.id
- "<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{state.text}"
-
- severity = (@model && @model.get 'severity') || @templateRule.get 'severity'
- @ui.customRuleCreationSeverity.val severity
- @ui.customRuleCreationSeverity.select2
- width: '250px'
- minimumResultsForSearch: 999
- formatResult: format
- formatSelection: format
-
- status = (@model && @model.get 'status') || @templateRule.get 'status'
- @ui.customRuleCreationStatus.val status
- @ui.customRuleCreationStatus.select2
- width: '250px'
- minimumResultsForSearch: 999
-
-
- show: ->
- @render()
- @$el.dialog 'open'
-
-
- hide: ->
- @$el.dialog 'close'
-
-
- serializeData: ->
- params = {}
- if @templateRule
- params = @templateRule.get 'params'
- else if @model and @model.has 'params'
- params = @model.get('params').map (p) ->
- _.extend p,
- value: p.defaultValue
-
- _.extend super,
- change: @model && @model.has 'key'
- params: params
- severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']
- statuses: _.map @options.app.statuses, (value, key) ->
- id: key
- text: value
+++ /dev/null
-define [
- 'backbone.marionette'
- 'templates/coding-rules-old'
- 'common/popup'
-], (
- Marionette
- Templates
- Popup
-) ->
-
- class CodingRulesDebtPopupView extends Popup
- template: Templates['coding-rules-debt-popup']
-
- serializeData: ->
- _.extend super,
- subcharacteristic: @options.app.getSubcharacteristicName(@model.get 'debtSubChar')
+++ /dev/null
-define [
- 'backbone.marionette'
- 'templates/coding-rules-old'
-], (
- Marionette
- Templates
-) ->
-
- class CodingRulesDetailCustomRuleView extends Marionette.ItemView
- tagName: 'tr'
- className: 'coding-rules-detail-custom-rule'
- template: Templates['coding-rules-detail-custom-rule']
-
- ui:
- delete: '.coding-rules-detail-custom-rule-delete'
-
- events:
- 'click @ui.delete': 'delete'
-
- delete: ->
- confirmDialog
- title: t 'delete'
- html: t 'are_you_sure'
- yesHandler: =>
- origEl = @$el.html()
- @$el.html '<i class="spinner"></i>'
-
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/delete"
- data:
- key: @model.get 'key'
- .done =>
- templateKey = @options.templateKey or @options.templateRule.get 'key'
- @options.app.showRule templateKey
- .fail =>
- @$el.html origEl
-
- serializeData: ->
- _.extend super,
- templateRule: @options.templateRule
- canWrite: @options.app.canWrite
+++ /dev/null
-define [
- 'backbone.marionette'
- 'coding-rules-old/views/coding-rules-detail-custom-rule-view'
-], (
- Marionette
- CodingRulesDetailCustomRuleView
-) ->
-
- class CodingRulesDetailCustomRulesView extends Marionette.CollectionView
- tagName: 'table'
- className: 'width100'
- itemView: CodingRulesDetailCustomRuleView
-
- itemViewOptions: ->
- app: @options.app
- templateRule: @options.templateRule
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesDetailQualityProfileView extends Marionette.ItemView
- className: 'coding-rules-detail-quality-profile'
- template: Templates['coding-rules-detail-quality-profile']
-
-
- modelEvents:
- 'change': 'render'
-
-
- ui:
- change: '.coding-rules-detail-quality-profile-change'
- revert: '.coding-rules-detail-quality-profile-revert'
- deactivate: '.coding-rules-detail-quality-profile-deactivate'
-
-
- events:
- 'click @ui.change': 'change'
- 'click @ui.revert': 'revert'
- 'click @ui.deactivate': 'deactivate'
-
-
- change: ->
- @options.app.codingRulesQualityProfileActivationView.model = @model
- @options.app.codingRulesQualityProfileActivationView.show()
-
-
- revert: ->
- ruleKey = @options.rule.get('key')
- confirmDialog
- title: t 'coding_rules.revert_to_parent_definition'
- html: tp 'coding_rules.revert_to_parent_definition.confirm', @getParent().name
- yesHandler: =>
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualityprofiles/activate_rule"
- data:
- profile_key: @model.get('qProfile')
- rule_key: ruleKey
- reset: true
- .done =>
- @options.app.showRule ruleKey
-
-
- deactivate: ->
- ruleKey = @options.rule.get('key')
- myProfile = _.findWhere(@options.app.qualityProfiles, key: @model.get('qProfile'))
- confirmDialog
- title: t 'coding_rules.deactivate'
- html: tp 'coding_rules.deactivate.confirm', myProfile.name
- yesHandler: =>
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualityprofiles/deactivate_rule"
- data:
- profile_key: @model.get('qProfile')
- rule_key: ruleKey
- .done =>
- @options.app.showRule ruleKey
-
-
- enableUpdate: ->
- @ui.update.prop 'disabled', false
-
-
- getParent: ->
- return null unless @model.get('inherit') && @model.get('inherit') != 'NONE'
- myProfile = _.findWhere(@options.app.qualityProfiles, key: @model.get('qProfile'))
- parentKey = myProfile.parentKey
- parent = _.extend {}, _.findWhere(@options.app.qualityProfiles, key: parentKey)
- parentActiveInfo = @model.collection.findWhere(qProfile: parentKey) or new Backbone.Model()
- _.extend parent, parentActiveInfo.toJSON()
- parent
-
-
- enhanceParameters: ->
- parent = @getParent()
- params = _.sortBy(@model.get('params'), 'key')
- return params unless parent
- params.map (p) ->
- parentParam = _.findWhere(parent.params, key: p.key)
- if parentParam
- _.extend p, original: _.findWhere(parent.params, key: p.key).value
- else
- p
-
-
- serializeData: ->
- hash = _.extend super,
- parent: @getParent()
- parameters: @enhanceParameters()
- canWrite: @options.app.canWrite
- templateKey: @options.rule.get 'templateKey'
- isTemplate: @options.rule.get 'isTemplate'
+++ /dev/null
-define [
- 'backbone.marionette'
- 'coding-rules-old/views/coding-rules-detail-quality-profile-view'
-], (
- Marionette,
- CodingRulesDetailQualityProfileView
-) ->
-
- class CodingRulesDetailQualityProfilesView extends Marionette.CollectionView
- itemView: CodingRulesDetailQualityProfileView
-
- itemViewOptions: ->
- app: @options.app
- rule: @options.rule
- qualityProfiles: @collection
+++ /dev/null
-define [
- 'backbone'
- 'backbone.marionette'
- 'coding-rules-old/views/coding-rules-detail-quality-profiles-view'
- 'coding-rules-old/views/coding-rules-detail-quality-profile-view'
- 'coding-rules-old/views/coding-rules-detail-custom-rules-view'
- 'coding-rules-old/views/coding-rules-detail-custom-rule-view'
- 'coding-rules-old/views/coding-rules-parameter-popup-view'
- 'coding-rules-old/views/coding-rules-debt-popup-view'
- 'templates/coding-rules-old'
-], (
- Backbone
- Marionette
- CodingRulesDetailQualityProfilesView
- CodingRulesDetailQualityProfileView
- CodingRulesDetailCustomRulesView
- CodingRulesDetailCustomRuleView
- CodingRulesParameterPopupView
- CodingRulesDebtPopupView
- Templates
-) ->
-
- class CodingRulesDetailView extends Marionette.Layout
- template: Templates['coding-rules-detail']
-
-
- regions:
- qualityProfilesRegion: '#coding-rules-detail-quality-profiles'
- customRulesRegion: '.coding-rules-detail-custom-rules-section'
- customRulesListRegion: '#coding-rules-detail-custom-rules'
- contextRegion: '.coding-rules-detail-context'
-
-
- ui:
- tagsChange: '.coding-rules-detail-tags-change'
- tagInput: '.coding-rules-detail-tag-input'
- tagsEdit: '.coding-rules-detail-tag-edit'
- tagsEditDone: '.coding-rules-detail-tag-edit-done'
- tagsEditCancel: '.coding-rules-details-tag-edit-cancel'
- tagsList: '.coding-rules-detail-tag-list'
-
- subcharacteristic: '.coding-rules-subcharacteristic'
-
- descriptionExtra: '#coding-rules-detail-description-extra'
- extendDescriptionLink: '#coding-rules-detail-extend-description'
- extendDescriptionForm: '.coding-rules-detail-extend-description-form'
- extendDescriptionSubmit: '#coding-rules-detail-extend-description-submit'
- extendDescriptionRemove: '#coding-rules-detail-extend-description-remove'
- extendDescriptionText: '#coding-rules-detail-extend-description-text'
- extendDescriptionSpinner: '#coding-rules-detail-extend-description-spinner'
- cancelExtendDescription: '#coding-rules-detail-extend-description-cancel'
-
- activateQualityProfile: '#coding-rules-quality-profile-activate'
- activateContextQualityProfile: '.coding-rules-detail-quality-profile-activate'
- changeQualityProfile: '.coding-rules-detail-quality-profile-update'
- createCustomRule: '#coding-rules-custom-rules-create'
- changeCustomRule: '#coding-rules-detail-custom-rule-change'
- changeManualRule: '#coding-rules-detail-manual-rule-change'
- deleteCustomRule: '#coding-rules-detail-rule-delete'
-
-
- events:
- 'click @ui.tagsChange': 'changeTags'
- 'click @ui.tagsEditDone': 'editDone'
- 'click @ui.tagsEditCancel': 'cancelEdit'
-
- 'click @ui.extendDescriptionLink': 'showExtendDescriptionForm'
- 'click @ui.cancelExtendDescription': 'hideExtendDescriptionForm'
- 'click @ui.extendDescriptionSubmit': 'submitExtendDescription'
- 'click @ui.extendDescriptionRemove': 'removeExtendedDescription'
-
- 'click @ui.activateQualityProfile': 'activateQualityProfile'
- 'click @ui.activateContextQualityProfile': 'activateContextQualityProfile'
- 'click @ui.changeQualityProfile': 'changeQualityProfile'
- 'click @ui.createCustomRule': 'createCustomRule'
- 'click @ui.changeCustomRule': 'changeCustomRule'
- 'click @ui.changeManualRule': 'changeManualRule'
- 'click @ui.deleteCustomRule': 'deleteRule'
-
- 'click .coding-rules-detail-parameter-name': 'toggleParameterDescription'
- 'click .coding-rules-subcharacteristic': 'showDebtPopup'
-
- initialize: (options) ->
- super options
-
- if @model.get 'params'
- origParams = @model.get('params')
- @model.set 'params', _.sortBy(origParams, 'key')
-
- _.map options.actives, (active) =>
- _.extend active, options.app.getQualityProfileByKey active.qProfile
- qualityProfiles = new Backbone.Collection options.actives,
- comparator: 'name'
- @qualityProfilesView = new CodingRulesDetailQualityProfilesView
- app: @options.app
- collection: qualityProfiles
- rule: @model
-
- unless @model.get 'isTemplate'
- qualityProfileKey = @options.app.getQualityProfile()
-
- if qualityProfileKey
- @contextProfile = qualityProfiles.findWhere qProfile: qualityProfileKey
- unless @contextProfile
- @contextProfile = new Backbone.Model
- key: qualityProfileKey, name: @options.app.qualityProfileFilter.view.renderValue()
- @contextQualityProfileView = new CodingRulesDetailQualityProfileView
- app: @options.app
- model: @contextProfile
- rule: @model
- qualityProfiles: qualityProfiles
-
- @listenTo @contextProfile, 'destroy', @hideContext
-
- onRender: ->
- @$el.find('.open-modal').modal()
-
- if @model.get 'isTemplate'
- @$(@contextRegion.el).hide()
-
- if _.isEmpty(@options.actives)
- @$(@qualityProfilesRegion.el).hide()
- else
- @qualityProfilesRegion.show @qualityProfilesView
-
- @$(@customRulesRegion.el).show()
- customRulesOriginal = @$(@customRulesRegion.el).html()
-
- @$(@customRulesRegion.el).html '<i class="spinner"></i>'
-
- customRules = new Backbone.Collection()
- jQuery.ajax
- url: "#{baseUrl}/api/rules/search"
- data:
- template_key: @model.get 'key'
- f: 'name,severity,params'
- .done (r) =>
- customRules.add r.rules
-
- # Protect against element disappearing due to navigation
- if @customRulesRegion
- if customRules.isEmpty() and not @options.app.canWrite
- @$(@customRulesRegion.el).hide()
- else
- @customRulesView = new CodingRulesDetailCustomRulesView
- app: @options.app
- collection: customRules
- templateRule: @model
- @$(@customRulesRegion.el).html customRulesOriginal
- @customRulesListRegion.show @customRulesView
-
- else
- @$(@customRulesRegion.el).hide()
- @$(@qualityProfilesRegion.el).show()
- @qualityProfilesRegion.show @qualityProfilesView
-
- if @options.app.getQualityProfile() and (@options.app.canWrite or @contextProfile.has('severity'))
- @$(@contextRegion.el).show()
- @contextRegion.show @contextQualityProfileView
- else
- @$(@contextRegion.el).hide()
-
- that = @
- jQuery.ajax
- url: "#{baseUrl}/api/rules/tags"
- .done (r) =>
- if @ui.tagInput.select2
- # Prevent synchronization issue with navigation
- @ui.tagInput.select2
- tags: _.difference (_.difference r.tags, that.model.get 'tags'), that.model.get 'sysTags'
- width: '300px'
-
- @ui.tagsEdit.hide()
-
- @ui.extendDescriptionForm.hide()
- @ui.extendDescriptionSpinner.hide()
-
-
- toggleParameterDescription: (e) ->
- jQuery(e.currentTarget).next('.coding-rules-detail-parameter-description').toggle();
-
-
- showDebtPopup: (e) ->
- e.stopPropagation()
- jQuery('body').click()
- popup = new CodingRulesDebtPopupView
- model: @model
- app: @options.app
- triggerEl: jQuery(e.currentTarget)
- popup.render()
- false
-
-
- hideContext: ->
- @contextRegion.reset()
- @$(@contextRegion.el).hide()
-
-
- changeTags: ->
- if @ui.tagsEdit.show
- @ui.tagsEdit.show()
- if @ui.tagsList.hide
- @ui.tagsList.hide()
- @tagsBuffer = @ui.tagInput.select2 'val'
- key.setScope 'tags'
- key 'escape', 'tags', => @cancelEdit()
-
-
- cancelEdit: ->
- key.unbind 'escape', 'tags'
- if @ui.tagsList.show
- @ui.tagsList.show()
- if @ui.tagInput.select2
- console.log @tagsBuffer
- @ui.tagInput.select2 'val', @tagsBuffer
- @ui.tagInput.select2 'close'
- if @ui.tagsEdit.hide
- @ui.tagsEdit.hide()
-
-
- editDone: ->
- @ui.tagsEdit.html '<i class="spinner"></i>'
- tags = @ui.tagInput.val()
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/update"
- data:
- key: @model.get 'key'
- tags: tags
- .done (r) =>
- @model.set 'tags', r.rule.tags
- @cancelEdit()
- .always =>
- @render()
-
-
- showExtendDescriptionForm: ->
- @ui.descriptionExtra.hide()
- @ui.extendDescriptionForm.show()
- key.setScope 'extraDesc'
- key 'escape', 'extraDesc', => @hideExtendDescriptionForm()
- @ui.extendDescriptionText.focus()
-
-
- hideExtendDescriptionForm: ->
- key.unbind 'escape', 'extraDesc'
- @ui.descriptionExtra.show()
- @ui.extendDescriptionForm.hide()
-
-
- submitExtendDescription: ->
- @ui.extendDescriptionForm.hide()
- @ui.extendDescriptionSpinner.show()
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/update"
- dataType: 'json'
- data:
- key: @model.get 'key'
- markdown_note: @ui.extendDescriptionText.val()
- .done (r) =>
- @model.set
- htmlNote: r.rule.htmlNote
- mdNote: r.rule.mdNote
- @render()
-
-
- removeExtendedDescription: ->
- confirmDialog
- html: t 'coding_rules.remove_extended_description.confirm'
- yesHandler: =>
- @ui.extendDescriptionText.val ''
- @submitExtendDescription()
-
-
- activateQualityProfile: ->
- @options.app.codingRulesQualityProfileActivationView.model = null
- @options.app.codingRulesQualityProfileActivationView.show()
-
-
- activateContextQualityProfile: ->
- @options.app.codingRulesQualityProfileActivationView.model = @contextProfile
- @options.app.codingRulesQualityProfileActivationView.show()
-
- createCustomRule: ->
- @options.app.codingRulesCustomRuleCreationView.templateRule = @model
- @options.app.codingRulesCustomRuleCreationView.model = new Backbone.Model()
- @options.app.codingRulesCustomRuleCreationView.show()
-
-
- changeCustomRule: ->
- @options.app.codingRulesCustomRuleCreationView.model = @model
- @options.app.codingRulesCustomRuleCreationView.show()
-
-
- changeManualRule: ->
- @options.app.codingRulesManualRuleCreationView.model = @model
- @options.app.codingRulesManualRuleCreationView.show()
-
-
- deleteRule: ->
- ruleType = if @model.has('templateKey') then 'custom' else 'manual'
- confirmDialog
- title: t 'delete'
- html: tp "coding_rules.delete.#{ruleType}.confirm", @model.get('name')
- yesHandler: =>
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/delete"
- data:
- key: @model.get 'key'
- .done =>
- @options.app.fetchFirstPage()
- .fail =>
- @options.app.showRule @model.get('key')
-
-
- serializeData: ->
- contextQualityProfile = @options.app.getQualityProfile()
- repoKey = @model.get 'repo'
- isManual = (@options.app.manualRepository().key == repoKey)
- isCustom = (@model.has 'templateKey')
-
- qualityProfilesVisible = not isManual
- if qualityProfilesVisible
- if @model.get 'isTemplate'
- qualityProfilesVisible = (not _.isEmpty(@options.actives))
- else
- qualityProfilesVisible = (@options.app.canWrite or not _.isEmpty(@options.actives))
-
-
- _.extend super,
- contextQualityProfile: contextQualityProfile
- contextQualityProfileName: @options.app.qualityProfileFilter.view.renderValue()
- qualityProfile: @contextProfile
- language: @options.app.languages[@model.get 'lang']
- repository: _.find(@options.app.repositories, (repo) -> repo.key == repoKey).name
- isManual: isManual
- canWrite: @options.app.canWrite
- isEditable: (@options.app.canWrite and (isManual or isCustom))
- qualityProfilesVisible: qualityProfilesVisible
- subcharacteristic: @options.app.getSubcharacteristicName(@model.get 'debtSubChar')
- createdAt: moment(@model.get 'createdAt').toDate()
- allTags: _.union @model.get('sysTags'), @model.get('tags')
+++ /dev/null
-define [
- 'backbone.marionette'
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesFacetsView extends Marionette.ItemView
- template: Templates['coding-rules-facets']
-
-
- ui:
- facets: '.navigator-facets-list-item'
- options: '.facet'
-
-
- events:
- 'click @ui.options': 'selectOption'
-
-
- initialize: ->
- super()
- that = @
- @options.collection.each (facet) ->
- property = facet.get 'property'
- facet.set 'property_message', t 'coding_rules.facets.' + property
- facet.set 'limitReached', facet.get('values').length >= 10
- _.each(facet.get('values'), (value) ->
- value.text = that.options.app.facetLabel(property, value.val)
- )
-
- selectOption: (e) ->
- option = jQuery(e.currentTarget)
- option.toggleClass 'active'
- property = option.closest('.navigator-facets-list-item').data('property')
- value = option.data('key')
- @options.app.filterBarView.toggle(property, value)
- @applyOptions()
-
-
- applyOptions: ->
- @options.app.fetchFirstPage()
-
-
- restoreFromQuery: (params) ->
- @ui.options.each ->
- jQuery(@).removeClass('active')
- @ui.facets.each ->
- property = jQuery(@).data 'property'
- if !!params[property]
- _(params[property].split(',')).map (value) ->
- jQuery('.navigator-facets-list-item[data-property="' + property + '"] .facet[data-key="' + value + '"]').addClass 'active'
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesListEmptyView extends Marionette.ItemView
- tagName: 'li'
- className: 'navigator-results-no-results'
- template: Templates['coding-rules-list-empty']
+++ /dev/null
-define [
- 'backbone.marionette',
- 'coding-rules-old/views/coding-rules-detail-view',
- 'templates/coding-rules-old'
-], (
- Marionette,
- CodingRulesDetailView,
- Templates
-) ->
-
- class CodingRulesListItemView extends Marionette.ItemView
- tagName: 'li'
- template: Templates['coding-rules-list-item']
- activeClass: 'active'
-
-
- events: ->
- 'click': 'showDetail'
-
-
- showDetail: ->
- @options.listView.selectIssue @$el
- @options.app.showRule @model.get('key')
-
-
- serializeData: ->
- tags = _.union @model.get('sysTags'), @model.get('tags')
- _.extend super,
- manualRuleLabel: t 'coding_rules.manual_rule'
- allTags: tags
- showDetails: (@model.get('status') != 'READY') || (_.isArray(tags) && tags.length > 0)
+++ /dev/null
-define [
- 'backbone.marionette',
- 'coding-rules-old/views/coding-rules-list-item-view',
- 'coding-rules-old/views/coding-rules-list-empty-view'
-], (
- Marionette,
- CodingRulesListItemView,
- CodingRulesListEmptyView
-) ->
-
- class CodingRulesListView extends Marionette.CollectionView
- tagName: 'ol'
- className: 'navigator-results-list'
- itemView: CodingRulesListItemView,
- emptyView: CodingRulesListEmptyView,
-
-
- itemViewOptions: ->
- listView: @, app: @options.app
-
-
- initialize: ->
- openRule = (el) -> el.click()
- @openRule = _.debounce openRule, 300
- key.setScope 'list'
-
-
- onRender: ->
- key 'up', 'list', (e) =>
- @selectPrev()
- #e.stopPropagation()
- key 'down', 'list', (e) =>
- @selectNext()
- #e.stopPropagation()
-
- $scrollEl = jQuery('.navigator-results')
- scrollEl = $scrollEl.get(0)
- onScroll = =>
- if scrollEl.offsetHeight + scrollEl.scrollTop >= scrollEl.scrollHeight
- @options.app.fetchNextPage()
- throttledScroll = _.throttle onScroll, 300
- $scrollEl.off('scroll').on 'scroll', throttledScroll
-
-
- onClose: ->
- @unbindEvents()
-
-
- unbindEvents: ->
- key.unbind 'up', 'list'
- key.unbind 'down', 'list'
-
-
- selectIssue: (el, open) ->
- @$('.active').removeClass 'active'
- el.addClass 'active'
- ruleKey = el.find('[name]').attr('name')
- rule = @collection.findWhere key: ruleKey
- @selected = @collection.indexOf(rule)
- @openRule el if open
-
-
- selectFirst: ->
- @selected = -1
- @selectNext()
-
-
- selectCurrent: ->
- @selected--
- @selectNext()
-
-
- selectNext: ->
- if @selected + 1 < @collection.length
- @selected += 1
- child = @$el.children().eq(@selected)
- container = jQuery('.navigator-results')
- containerHeight = container.height()
- bottom = child.position().top + child.outerHeight()
- if bottom > containerHeight
- container.scrollTop(container.scrollTop() - containerHeight + bottom)
- @selectIssue child, true
-
-
- selectPrev: ->
- if @selected > 0
- @selected -= 1
- child = @$el.children().eq(@selected)
- container = jQuery('.navigator-results')
- top = child.position().top
- if top < 0
- container.scrollTop(container.scrollTop() + top)
- @selectIssue child, true
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesManualRuleCreationView extends Marionette.ItemView
- template: Templates['coding-rules-manual-rule-creation']
-
-
- ui:
- manualRuleCreationKey: '#coding-rules-manual-rule-creation-key'
- manualRuleCreationName: '#coding-rules-manual-rule-creation-name'
- manualRuleCreationHtmlDescription: '#coding-rules-manual-rule-creation-html-description'
- manualRuleCreationSeverity: '#coding-rules-manual-rule-creation-severity'
- manualRuleCreationStatus: '#coding-rules-manual-rule-creation-status'
- manualRuleCreationParameters: '[name]'
- manualRuleCreationCreate: '#coding-rules-manual-rule-creation-create'
- manualRuleCreationReactivate: '#coding-rules-manual-rule-creation-reactivate'
- modalFoot: '.modal-foot'
-
-
- events:
- 'input @ui.manualRuleCreationName': 'generateKey'
- 'keydown @ui.manualRuleCreationName': 'generateKey'
- 'keyup @ui.manualRuleCreationName': 'generateKey'
-
- 'input @ui.manualRuleCreationKey': 'flagKey'
- 'keydown @ui.manualRuleCreationKey': 'flagKey'
- 'keyup @ui.manualRuleCreationKey': 'flagKey'
-
- 'click #coding-rules-manual-rule-creation-cancel': 'hide'
- 'click @ui.manualRuleCreationCreate': 'create'
- 'click @ui.manualRuleCreationReactivate': 'reactivate'
-
-
- generateKey: ->
- unless @keyModifiedByUser
- if @ui.manualRuleCreationKey
- generatedKey = @ui.manualRuleCreationName.val().latinize().replace(/[^A-Za-z0-9]/g, '_')
- @ui.manualRuleCreationKey.val generatedKey
-
- flagKey: ->
- @keyModifiedByUser = true
- # Cannot use @ui.manualRuleCreationReactivate.hide() directly since it was not there at initial render
- jQuery(@ui.manualRuleCreationReactivate.selector).hide()
-
-
- create: ->
- action = 'create'
- if @model and @model.has 'key'
- action = 'update'
-
- postData =
- name: @ui.manualRuleCreationName.val()
- markdown_description: @ui.manualRuleCreationHtmlDescription.val()
-
- if @model && @model.has 'key'
- postData.key = @model.get 'key'
- else
- postData.manual_key = @ui.manualRuleCreationKey.val()
- postData.prevent_reactivation = true
-
- @sendRequest(action, postData)
-
-
- reactivate: ->
- postData =
- name: @existingRule.name
- markdown_description: @existingRule.mdDesc
- manual_key: @ui.manualRuleCreationKey.val()
- prevent_reactivation: false
-
- @sendRequest('create', postData)
-
-
- sendRequest: (action, postData) ->
- @$('.modal-error').hide()
- @$('.modal-warning').hide()
-
- origFooter = @ui.modalFoot.html()
- @ui.modalFoot.html '<i class="spinner"></i>'
-
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/rules/" + action
- data: postData
- error: () ->
- .done (r) =>
- @options.app.showRule r.rule.key
- @hide()
- .fail (jqXHR, textStatus, errorThrown) =>
- if jqXHR.status == 409
- @existingRule = jqXHR.responseJSON.rule
- @$('.modal-warning').show()
- @ui.modalFoot.html Templates['coding-rules-manual-rule-reactivation'](@)
- else
- jQuery.ajaxSettings.error(jqXHR, textStatus, errorThrown)
- @ui.modalFoot.html origFooter
-
-
- onRender: ->
- @$el.dialog
- dialogClass: 'no-close',
- width: '600px',
- draggable: false,
- autoOpen: false,
- modal: true,
- minHeight: 50,
- resizable: false,
- title: null
-
- @keyModifiedByUser = false
-
- format = (state) ->
- return state.text unless state.id
- "<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{state.text}"
-
-
- show: ->
- @render()
- @$el.dialog 'open'
-
-
- hide: ->
- @$el.dialog 'close'
-
-
- serializeData: ->
- _.extend super,
- change: @model && @model.has 'key'
+++ /dev/null
-define [
- 'backbone.marionette'
- 'templates/coding-rules-old'
- 'common/popup'
-], (
- Marionette
- Templates
- Popup
-) ->
-
- $ = jQuery
-
-
- class CodingRulesParameterPopupView extends Popup
- template: Templates['coding-rules-parameter-popup']
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesQualityProfileActivationView extends Marionette.ItemView
- className: 'coding-rules-modal'
- template: Templates['coding-rules-quality-profile-activation']
-
-
- ui:
- qualityProfileSelect: '#coding-rules-quality-profile-activation-select'
- qualityProfileSeverity: '#coding-rules-quality-profile-activation-severity'
- qualityProfileActivate: '#coding-rules-quality-profile-activation-activate'
- qualityProfileParameters: '[name]'
-
-
- events:
- 'click #coding-rules-quality-profile-activation-cancel': 'hide'
- 'click @ui.qualityProfileActivate': 'activate'
-
-
- activate: ->
- profileKey = @ui.qualityProfileSelect.val()
- params = @ui.qualityProfileParameters.map(->
- key: jQuery(@).prop('name'), value: jQuery(@).val() || jQuery(@).prop('placeholder') || '').get()
-
- paramsHash = (params.map (param) -> param.key + '=' + window.csvEscape(param.value)).join(';')
-
- if @model
- profileKey = @model.get('qProfile')
- unless profileKey
- profileKey = @model.get('key')
- severity = @ui.qualityProfileSeverity.val()
-
- origFooter = @$('.modal-foot').html()
- @$('.modal-foot').html '<i class="spinner"></i>'
-
- ruleKey = @rule.get('key')
- jQuery.ajax
- type: 'POST'
- url: "#{baseUrl}/api/qualityprofiles/activate_rule"
- data:
- profile_key: profileKey
- rule_key: ruleKey
- severity: severity
- params: paramsHash
- .done =>
- @options.app.showRule ruleKey
- @hide()
- .fail =>
- @$('.modal-foot').html origFooter
-
-
- onRender: ->
- @$el.dialog
- dialogClass: 'no-close',
- width: '600px',
- draggable: false,
- autoOpen: false,
- modal: true,
- minHeight: 50,
- resizable: false,
- title: null
-
- @ui.qualityProfileSelect.select2
- width: '250px'
- minimumResultsForSearch: 5
-
- format = (state) ->
- return state.text unless state.id
- "<i class='icon-severity-#{state.id.toLowerCase()}'></i> #{state.text}"
-
- severity = (@model && @model.get 'severity') || @rule.get 'severity'
- @ui.qualityProfileSeverity.val severity
- @ui.qualityProfileSeverity.select2
- width: '250px'
- minimumResultsForSearch: 999
- formatResult: format
- formatSelection: format
-
-
- show: ->
- @render()
- @$el.dialog 'open'
-
-
- hide: ->
- @$el.dialog 'close'
-
-
- getAvailableQualityProfiles: (lang) ->
- activeQualityProfiles = @options.app.detailView.qualityProfilesView.collection
- inactiveProfiles = _.reject @options.app.qualityProfiles, (profile) =>
- activeQualityProfiles.findWhere key: profile.key
- _.filter inactiveProfiles, (profile) =>
- profile.lang == lang
-
-
- serializeData: ->
- params = @rule.get 'params'
- if @model
- modelParams = @model.get 'params'
- if modelParams
- params = params.map (p) ->
- parentParam = _.findWhere(modelParams, key: p.key)
- if parentParam
- _.extend p, value: _.findWhere(modelParams, key: p.key).value
- else
- p
-
- availableProfiles = @getAvailableQualityProfiles(@rule.get 'lang')
-
- _.extend super,
- rule: @rule.toJSON()
- change: @model && @model.has 'severity'
- params: params
- qualityProfiles: availableProfiles
- severities: ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']
- saveEnabled: not _.isEmpty(availableProfiles) or (@model and @model.get('qProfile'))
- isCustomRule: (@model and @model.has('templateKey')) or @rule.has 'templateKey'
+++ /dev/null
-define [
- 'navigator/filters/filter-bar',
- 'navigator/filters/base-filters',
- 'navigator/filters/favorite-filters',
- 'navigator/filters/more-criteria-filters',
- 'navigator/filters/read-only-filters',
- 'templates/coding-rules-old'
-], (
- FilterBarView,
- BaseFilters,
- FavoriteFiltersModule,
- MoreCriteriaFilters,
- ReadOnlyFilterView,
- Templates
-) ->
-
- class CodingRulesFilterBarView extends FilterBarView
- template: Templates['coding-rules-filter-bar']
-
- collectionEvents:
- 'change:enabled': 'changeEnabled'
-
-
- events:
- 'click .navigator-filter-submit': 'search'
-
-
- onRender: ->
- @selectFirst()
-
-
- getQuery: ->
- query = {}
- @collection.each (filter) ->
- _.extend query, filter.view.formatValue()
- query
-
-
- onAfterItemAdded: (itemView) ->
- if itemView.model.get('type') == FavoriteFiltersModule.FavoriteFilterView
- jQuery('.navigator-header').addClass 'navigator-header-favorite'
-
-
- addMoreCriteriaFilter: ->
- readOnlyFilters = @collection.where(type: ReadOnlyFilterView)
- disabledFilters = _.difference(@collection.where(enabled: false), readOnlyFilters)
- if disabledFilters.length > 0
- @moreCriteriaFilter = new BaseFilters.Filter
- type: MoreCriteriaFilters.MoreCriteriaFilterView,
- enabled: true,
- optional: false,
- filters: disabledFilters
- @collection.add @moreCriteriaFilter
-
-
- changeEnabled: ->
- if @moreCriteriaFilter?
- disabledFilters = _.reject @collection.where(enabled: false), (filter) ->
- filter.get('type') in [MoreCriteriaFilters.MoreCriteriaFilterView, ReadOnlyFilterView]
-
- if disabledFilters.length == 0
- @moreCriteriaFilter.set { enabled: false }, { silent: true }
- else
- @moreCriteriaFilter.set { enabled: true }, { silent: true }
-
- @moreCriteriaFilter.set { filters: disabledFilters }, { silent: true }
- @moreCriteriaFilter.trigger 'change:filters'
-
-
- search: ->
- @$('.navigator-filter-submit').blur()
- @options.app.state.set
- query: this.options.app.getQuery(),
- search: true
- @options.app.fetchFirstPage()
-
-
- fetchNextPage: ->
- @options.app.fetchNextPage()
-
-
- restoreFromWsQuery: (query) ->
- params = _.map(query, (value, key) ->
- 'key': key
- 'value': value
- )
- @restoreFromQuery params
-
-
- toggle: (property, value) ->
- filter = @collection.findWhere(property: property)
- unless filter.view.isActive()
- @moreCriteriaFilter.view.detailsView.enableByProperty(property)
- choice = filter.view.choices.get(value)
- choice.set 'checked', !choice.get('checked')
- filter.view.detailsView.updateValue()
- filter.view.detailsView.updateLists()
+++ /dev/null
-define [
- 'coding-rules-old/views/filters/profile-dependent-filter-view'
-], (
- ProfileDependentFilterView
-) ->
-
- class ActivationFilterView extends ProfileDependentFilterView
- tooltip: 'coding_rules.filters.activation.help'
-
-
- makeActive: ->
- super
- filterValue = @model.get 'value'
- if !filterValue or filterValue.length == 0
- @choices.each (model) -> model.set 'checked', model.id == 'true'
- @model.set 'value', ['true']
- @detailsView.updateLists()
-
-
-
- showDetails: ->
- super unless @$el.is '.navigator-filter-inactive'
-
-
- restore: (value) ->
- value = value.split(',') if _.isString(value)
- if @choices && value.length > 0
- @choices.each (model) -> model.set 'checked', value.indexOf(model.id) >= 0
- @model.set value: value, enabled: true
- @onChangeQualityProfile()
- else
- @clear()
+++ /dev/null
-
-define [
- 'coding-rules-old/views/filters/profile-dependent-filter-view'
-], (
- ProfileDependentFilterView
-) ->
-
- class ActiveSeveritiesFilterView extends ProfileDependentFilterView
- tooltip: 'coding_rules.filters.active_severity.inactive'
+++ /dev/null
-define [
- 'navigator/filters/choice-filters'
-], (
- ChoiceFilters
-) ->
-
- class CharacteriticFilterView extends ChoiceFilters.ChoiceFilterView
-
- initialize: ->
- super
- @choices.comparator = 'text'
- @choices.sort()
+++ /dev/null
-define [
- 'coding-rules-old/views/filters/profile-dependent-filter-view'
-], (
- ProfileDependentFilterView
-) ->
-
- class InheritanceFilterView extends ProfileDependentFilterView
- tooltip: 'coding_rules.filters.inheritance.inactive'
-
- onChangeQualityProfile: ->
- qualityProfileKey = @qualityProfileFilter.get 'value'
- if _.isArray(qualityProfileKey) && qualityProfileKey.length == 1
- qualityProfile = @options.app.getQualityProfileByKey qualityProfileKey[0]
- if qualityProfile.parentKey
- parentQualityProfile = @options.app.getQualityProfile qualityProfile.parentKey
- if parentQualityProfile
- @makeActive()
- else
- @makeInactive()
- else
- @makeInactive()
- else
- @makeInactive()
+++ /dev/null
-define [
- 'navigator/filters/choice-filters',
- 'templates/coding-rules-old'
-], (
- ChoiceFilters,
- Templates
-) ->
-
- class LanguageFilterView extends ChoiceFilters.ChoiceFilterView
-
- modelEvents:
- 'change:value': 'onChangeValue'
- 'change:enabled': 'focus',
-
-
- initialize: ->
- super
- @choices.comparator = 'text'
- @choices.sort()
- @app = @model.get 'app'
- @listenTo @app.qualityProfileFilter, 'change:value', @onChangeProfile
- @selectedFromProfile = false
-
- onChangeProfile: ->
- profiles = @app.qualityProfileFilter.get 'value'
- if _.isArray(profiles) && profiles.length > 0
- profile = _.findWhere @app.qualityProfiles, key: profiles[0]
- @options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
- @choices.each (item) -> item.set 'checked', item.id == profile.lang
- @refreshValues()
- @selectedFromProfile = true
- else if @selectedFromProfile
- @choices.each (item) -> item.set 'checked', false
- @refreshValues()
-
- onChangeValue: ->
- @selectedFromProfile = false
- @renderBase()
-
-
- refreshValues: ->
- @detailsView.updateValue()
- @detailsView.updateLists()
- @render()
- @hideDetails()
+++ /dev/null
-define [
- 'navigator/filters/choice-filters'
-], (
- ChoiceFilters
-) ->
-
- class ProfileDependentFilterView extends ChoiceFilters.ChoiceFilterView
- tooltip: 'coding_rules.filters.activation.help'
-
- initialize: ->
- super
- @qualityProfileFilter = @model.get 'qualityProfileFilter'
- @listenTo @qualityProfileFilter, 'change:value', @onChangeQualityProfile
- @onChangeQualityProfile()
-
-
- onChangeQualityProfile: ->
- qualityProfileKey = @qualityProfileFilter.get 'value'
- if _.isArray(qualityProfileKey) && qualityProfileKey.length == 1
- @makeActive()
- else
- @makeInactive()
-
-
- makeActive: ->
- @model.set inactive: false, title: ''
- @model.trigger 'change:enabled'
- @$el.removeClass('navigator-filter-inactive').prop 'title', ''
- @options.filterBarView.moreCriteriaFilter.view.detailsView.enableByProperty(@detailsView.model.get 'property')
- @hideDetails()
-
-
- makeInactive: ->
- @model.set inactive: true, title: t @tooltip
- @model.trigger 'change:enabled'
- @choices.each (model) -> model.set 'checked', false
- @detailsView.updateLists()
- @detailsView.updateValue()
- @$el.addClass('navigator-filter-inactive').prop 'title', t @tooltip
-
-
- showDetails: ->
- super unless @$el.is '.navigator-filter-inactive'
-
-
- restore: (value) ->
- value = value.split(',') if _.isString(value)
- if @choices && value.length > 0
- @model.set value: value, enabled: true
- @choices.each (item) ->
- item.set 'checked', false
- _.each value, (v) =>
- cModel = @choices.findWhere id: v
- cModel.set 'checked', true
- @onChangeQualityProfile()
- else
- @clear()
+++ /dev/null
-define [
- 'navigator/filters/choice-filters',
- 'templates/coding-rules-old'
-], (
- ChoiceFilters,
- Templates
-) ->
-
- class QualityProfileDetailFilterView extends ChoiceFilters.DetailsChoiceFilterView
- itemTemplate: Templates['coding-rules-profile-filter-detail']
-
-
- class QualityProfileFilterView extends ChoiceFilters.ChoiceFilterView
-
- initialize: ->
- super
- detailsView: QualityProfileDetailFilterView
-
- @app = @model.get 'app'
-
- @allProfiles = @model.get 'choices'
- @updateChoices @allProfiles
-
- @listenTo @app.languageFilter, 'change:value', @onChangeLanguage
- @onChangeLanguage()
-
-
- onChangeLanguage: ->
- languages = @app.languageFilter.get 'value'
- if _.isArray(languages) && languages.length > 0
- @filterLanguages(languages)
- else
- @updateChoices(@allProfiles)
-
- filterLanguages: (languages) ->
- languageProfiles = _.filter( @allProfiles, (prof) -> languages.indexOf(prof.lang) >= 0 )
- @updateChoices(languageProfiles)
-
-
- updateChoices: (collection) ->
- languages = @app.languages
- currentValue = @model.get('value')
- @choices = new Backbone.Collection( _.map collection, (item, index) ->
- new Backbone.Model
- id: item.key
- text: item.name
- checked: false
- index: index
- language: languages[item.lang]
- comparator: 'index'
- )
- if currentValue
- @restore(currentValue)
- @render()
-
- render: ->
- super
- if @model.get 'value'
- @$el.addClass('navigator-filter-context')
- else
- @$el.removeClass('navigator-filter-context')
+++ /dev/null
-define [
- 'backbone',
- 'backbone.marionette',
- 'navigator/filters/base-filters',
- 'navigator/filters/string-filters',
- 'navigator/filters/choice-filters',
- 'templates/coding-rules-old',
- 'common/handlebars-extensions'
-], (
- Backbone,
- Marionette,
- BaseFilters,
- StringFilterView,
- ChoiceFilters,
- Templates
-) ->
-
- class QueryFilterView extends StringFilterView
- template: Templates['coding-rules-query-filter']
- className: 'navigator-filter navigator-filter-query'
-
- events:
- 'keypress input': 'checkSubmit'
- 'change input': 'change'
- 'click': 'focus'
- 'blur': 'blur'
-
-
- change: (e) ->
- @model.set 'value', $j(e.target).val()
- @options.app.codingRules.sorting = sort: '', asc: ''
-
-
- clear: ->
- super
- @focus()
-
-
- focus: ->
- @$(':input').focus();
-
-
- blur: ->
- @$(':input').blur();
-
-
- serializeData: ->
- return _.extend({}, @model.toJSON(),
- value: this.model.get('value') || ''
- )
-
-
- initialize: ->
- super detailsView: null
- @model.set('size', 25) unless @model.get 'size'
-
-
- checkSubmit: (e) ->
- if (e.which == 13)
- e.preventDefault()
- @change(e)
- @blur()
- @options.app.filterBarView.$('.navigator-filter-submit').focus()
- @options.app.filterBarView.$('.navigator-filter-submit').click()
-
-
- renderInput: ->
- # Done in template
-
-
- toggleDetails: ->
- # NOP
-
-
- isDefaultValue: ->
- true
-
-
- renderBase: ->
- super
- @$el.prop('title', '');
+++ /dev/null
-define [
- 'navigator/filters/choice-filters',
- 'templates/coding-rules-old'
-], (
- ChoiceFilters,
- Templates
-) ->
-
- class RepositoryDetailFilterView extends ChoiceFilters.DetailsChoiceFilterView
- itemTemplate: Templates['coding-rules-repository-detail']
-
-
- class RepositoryFilterView extends ChoiceFilters.ChoiceFilterView
-
- initialize: ->
- super
- detailsView: RepositoryDetailFilterView
-
- @app = @model.get 'app'
-
- @allRepositories = @model.get 'choices'
- @updateChoices @allRepositories
-
- @listenTo @app.languageFilter, 'change:value', @onChangeLanguage
- @onChangeLanguage()
-
-
- onChangeLanguage: ->
- languages = @app.languageFilter.get 'value'
- if _.isArray(languages) && languages.length > 0
- @filterLanguages(languages)
- else
- @updateChoices(@allRepositories)
-
- filterLanguages: (languages) ->
- languageRepositories = _.filter( @allRepositories, (repo) -> languages.indexOf(repo.language) >= 0 )
- @updateChoices(languageRepositories)
-
-
- updateChoices: (collection) ->
- languages = @app.languages
- currentValue = @model.get('value')
- @choices = new Backbone.Collection( _.map collection, (item, index) ->
- new Backbone.Model
- id: item.key
- text: item.name
- checked: false
- index: index
- language: languages[item.language]
- comparator: (item) ->
- [item.get('text'), item.get('language')]
- )
- if currentValue
- @restore(currentValue)
- @render()
+++ /dev/null
-define [
- 'navigator/filters/choice-filters'
-], (
- ChoiceFilters
-) ->
-
- class TagFilterView extends ChoiceFilters.ChoiceFilterView
-
- initialize: ->
- super()
- @loadTags()
- # TODO Register an event handler to reload tags when they are modified on a rule
-
-
- loadTags: ->
- tagsXHR = jQuery.ajax
- url: "#{baseUrl}/api/rules/tags"
- async: false
-
- jQuery.when(tagsXHR).done (r) =>
- @choices = new Backbone.Collection(
- _.map(r.tags, (tag) ->
- new Backbone.Model
- id: tag
- text: tag
- ),
- comparator: 'text')
-
- if @tagToRestore
- @restore(@tagToRestore)
- @tagToRestore = null
- @render()
-
- restore: (value) ->
- unless @choices.isEmpty()
- super(value)
- else
- @tagToRestore = value
+++ /dev/null
-define [
- 'backbone.marionette',
- 'templates/coding-rules-old'
-], (
- Marionette,
- Templates
-) ->
-
- class CodingRulesHeaderView extends Marionette.ItemView
- template: Templates['coding-rules-header']
-
-
- events:
- 'click #coding-rules-new-search': 'newSearch'
- 'click #coding-rules-create-rule': 'createRule'
-
-
- newSearch: ->
- @options.app.router.emptyQuery()
-
-
- createRule: ->
- @options.app.createManualRule()
-
-
- serializeData: ->
- _.extend super,
- 'canWrite': @options.app.canWrite
+++ /dev/null
-<div class="navigator-actions-order">
- {{#if sorting}}
- {{t 'coding_rules.ordered_by'}} <strong>{{sorting.sortText}}</strong> {{#if sorting.asc}}<i class="icon-sort-asc"></i>{{else}}<i class="icon-sort-desc"></i>{{/if}}
- {{else}}
- {{t 'coding_rules.order'}}
- {{/if}}
-</div>
-<ul class="navigator-actions-order-choices">
- <li data-sort="" data-asc="">{{t 'coding_rules.sort.relevance'}}</li>
- <li data-sort="createdAt" data-asc="true">{{t 'coding_rules.sort.creation_date'}} <i class="icon-sort-asc"></i></li>
- <li data-sort="createdAt" data-asc="false">{{t 'coding_rules.sort.creation_date'}} <i class="icon-sort-desc"></i></li>
- <li data-sort="name" data-asc="true">{{t 'coding_rules.sort.name'}} <i class="icon-sort-asc"></i></li>
- <li data-sort="name" data-asc="false">{{t 'coding_rules.sort.name'}} <i class="icon-sort-desc"></i></li>
-</ul>
-<div class="navigator-actions-total">
- {{t 'coding_rules.found'}}: <strong>{{paging.total}}</strong>
- {{#if canWrite}}<a class="navigator-actions-bulk icon-bulk-change" title="{{t 'bulk_change'}}"></a>{{/if}}
-</div>
+++ /dev/null
-{{! activation }}
-
-<a class="coding-rules-bulk-change-dropdown-link" data-action="activate">
- {{t 'coding_rules.activate_in'}}…
-</a>
-
-{{#if allowActivateOnProfile}}
- <a class="coding-rules-bulk-change-dropdown-link" data-action="activate" data-param="{{qualityProfile}}">
- {{t 'coding_rules.activate_in'}} <strong>{{qualityProfileName}}</strong>
- </a>
-{{/if}}
-
-
-
-{{! deactivation }}
-
-<a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate">
- {{t 'coding_rules.deactivate_in'}}…
-</a>
-
-{{#if allowDeactivateOnProfile}}
- <a class="coding-rules-bulk-change-dropdown-link" data-action="deactivate" data-param="{{qualityProfile}}">
- {{tp 'coding_rules.deactivate_in'}} <strong>{{qualityProfileName}}</strong>
- </a>
-{{/if}}
+++ /dev/null
-<form>
- <div class="modal-head">
- {{#eq action 'activate'}}
- <h2>{{t 'coding_rules.activate_in_quality_profile'}} ({{paging.total}} {{t 'coding_rules._rules'}})</h2>
- {{/eq}}
- {{#eq action 'deactivate'}}
- <h2>{{t 'coding_rules.deactivate_in_quality_profile'}} ({{paging.total}} {{t 'coding_rules._rules'}})</h2>
- {{/eq}}
- </div>
-
- <div class="modal-body modal-body-select2">
- <div class="modal-error"></div>
- <div class="modal-warning"></div>
- <div class="modal-notice"></div>
-
- <div class="modal-field">
- <h3><label for="coding-rules-bulk-change-profile">
- {{#eq action 'change-severity'}}{{t 'coding_rules.change_severity_in'}}{{/eq}}
- {{#eq action 'activate'}}{{t 'coding_rules.activate_in'}}{{/eq}}
- {{#eq action 'deactivate'}}{{t 'coding_rules.deactivate_in'}}{{/eq}}
- </label></h3>
- {{#if qualityProfile}}
- <h3 class="readonly-field">{{qualityProfileName}}{{#notEq action 'change-severity'}} —
- {{t 'are_you_sure'}}{{/notEq}}</h3>
- {{else}}
- <select id="coding-rules-bulk-change-profile">
- {{#each availableQualityProfiles}}
- <option value="{{key}}">{{name}} - {{language}}</option>
- {{/each}}
- </select>
- {{/if}}
- </div>
- </div>
-
- <div class="modal-foot">
- <button id="coding-rules-submit-bulk-change">{{t 'apply'}}</button>
- <a id="coding-rules-cancel-bulk-change" class="action">{{t 'cancel'}}</a>
- <a id="coding-rules-close-bulk-change" class="action" style="display:none" href="#">{{t 'close'}}</a>
- </div>
-</form>
+++ /dev/null
-<form>
- <div class="modal-head">
- {{#if change}}
- <h2>{{t 'coding_rules.update_custom_rule'}}</h2>
- {{else}}
- <h2>{{t 'coding_rules.create_custom_rule'}}</h2>
- {{/if}}
- </div>
-
- <div class="modal-body">
- <div class="js-modal-messages"></div>
- <div class="modal-error"></div>
- <div class="modal-warning">{{t 'coding_rules.reactivate.help'}}</div>
-
- <table>
- <tr class="property">
- <th><h3>{{t 'name'}} <em class="mandatory">*</em></h3></th>
- <td>
- <input type="text" name="name" id="coding-rules-custom-rule-creation-name"
- class="coding-rules-name-key" value="{{name}}"/>
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'key'}}{{#unless change}} <em class="mandatory">*</em>{{/unless}}</h3></th>
- <td>
- {{#if change}}
- <span class="coding-rules-detail-custom-rule-key" title="{{key}}">{{key}}</span>
- {{else}}
- <input type="text" name="key" id="coding-rules-custom-rule-creation-key"
- class="coding-rules-name-key" value="{{internalKey}}"/>
- {{/if}}
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'description'}} <em class="mandatory">*</em></h3></th>
- <td>
- <textarea type="textarea" name="markdown_description" id="coding-rules-custom-rule-creation-html-description"
- class="coding-rules-markdown-description" rows="15">{{{mdDesc}}}</textarea>
- <span class="right">{{> '_markdown-tips' }}</span>
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'severity'}}</h3></th>
- <td>
- <select id="coding-rules-custom-rule-creation-severity">
- {{#each severities}}
- <option value="{{this}}">{{t 'severity' this}}</option>
- {{/each}}
- </select>
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'coding_rules.filters.status'}}</h3></th>
- <td>
- <select id="coding-rules-custom-rule-creation-status">
- {{#each statuses}}
- <option value="{{id}}">{{text}}</option>
- {{/each}}
- </select>
- </td>
- </tr>
- {{#each params}}
- <tr class="property">
- <th><h3>{{key}}</h3></th>
- <td>
- {{#eq type 'TEXT'}}
- <textarea class="width100" rows="3" name="{{key}}" placeholder="{{defaultValue}}">{{value}}</textarea>
- {{else}}
- <input type="text" name="{{key}}" value="{{value}}" placeholder="{{defaultValue}}"/>
- {{/eq}}
- <div class="note">{{htmlDesc}}</div>
- {{#if extra}}
- <div class="note">{{extra}}</div>
- {{/if}}
- </td>
- </tr>
- {{/each}}
- </table>
- </div>
-
- <div class="modal-foot">
- <button id="coding-rules-custom-rule-creation-create">
- {{#if change}}{{t 'save'}}{{else}}{{t 'create'}}{{/if}}
- </button>
- <a id="coding-rules-custom-rule-creation-cancel" class="action">{{t 'cancel'}}</a>
- </div>
-</form>
+++ /dev/null
-<button id="coding-rules-custom-rule-creation-reactivate">
- {{t 'coding_rules.reactivate'}}
-</button>
-<button id="coding-rules-custom-rule-creation-create">
- {{#if change}}{{t 'save'}}{{else}}{{t 'create'}}{{/if}}
-</button>
-<a id="coding-rules-custom-rule-creation-cancel" class="action">{{t 'cancel'}}</a>
+++ /dev/null
-<div class="coding-rules-debt-popup bubble-popup-container">
- <ul class="bubble-popup-list">
- {{#if debtRemFnType}}
- <li>
- <h3>{{t 'coding_rules.remediation_function'}}</h3>
- {{t 'coding_rules.remediation_function' debtRemFnType}}
- </li>
- {{/if}}
- {{#if debtRemFnCoeff}}
- <li>
- <h3>{{t 'coding_rules.remediation_function.coeff'}}</h3>
- {{debtRemFnCoeff}}
- </li>
- {{/if}}
- {{#if debtRemFnOffset}}
- <li>
- <h3>{{#eq debtRemFnType 'CONSTANT_ISSUE'}}
- {{t 'coding_rules.remediation_function.constant'}}
- {{else}}
- {{t 'coding_rules.remediation_function.offset'}}
- {{/eq}}
- </h3>
- {{debtRemFnOffset}}
- </li>
- {{/if}}
-</div>
-
-<div class="bubble-popup-arrow"></div>
+++ /dev/null
-<td class="coding-rules-detail-custom-rule-name">
- <a class="nolink" href="#rule_key={{key}}">{{name}}</a>
-</td>
-
-<td class="coding-rules-detail-custom-rule-severity">
- {{severityIcon severity}} {{t "severity" severity}}
-</td>
-
-<td class="coding-rules-detail-custom-rule-parameters">
- {{#each parameters}}
- <div class="coding-rules-detail-custom-rule-parameter">
- <span class="key">{{key}}</span><span class="sep">: </span><span class="value" title="{{value}}">{{value}}</span>
- </div>
- {{/each}}
-
-</td>
-
-{{#if canWrite}}
-<td class="coding-rules-detail-custom-rule-actions">
- <div class="button-group">
- <button class="coding-rules-detail-custom-rule-delete button-red">
- {{t 'delete'}}
- </button>
- </div>
-</td>
-{{/if}}
+++ /dev/null
-<table class="width100">
- <tbody>
- <tr>
- <td class="coding-rules-detail-quality-profile-name">
- {{name}}
- {{#if parent}}
- <div class="coding-rules-detail-quality-profile-inheritance">
- {{#eq inherit 'OVERRIDES'}}
- <i class="icon-inheritance" title="{{tp 'coding_rules.overrides' name parent.name}}"></i>
- {{/eq}}
- {{#eq inherit 'INHERITED'}}
- <i class="icon-inheritance" title="{{tp 'coding_rules.inherits' name parent.name}}"></i>
- {{/eq}}
- {{parent.name}}
- </div>
- {{/if}}
- </td>
-
- {{#if severity}}
- <td class="coding-rules-detail-quality-profile-severity">
- {{severityIcon severity}} {{t "severity" severity}}
- {{#if parent}}{{#notEq severity parent.severity}}
- <div class="coding-rules-detail-quality-profile-inheritance">
- {{t 'coding_rules.original'}} {{t 'severity' parent.severity}}
- </div>
- {{/notEq}}{{/if}}
- </td>
-
- {{#unless templateKey}}
- <td class="coding-rules-detail-quality-profile-parameters">
- {{#each parameters}}
- <div class="coding-rules-detail-quality-profile-parameter">
- <span class="key">{{key}}</span><span class="sep">: </span><span class="value" title="{{value}}">{{value}}</span>
- {{#if ../parent}}{{#notEq value original}}
- <div class="coding-rules-detail-quality-profile-inheritance">
- {{t 'coding_rules.original'}} <span class="value">{{original}}</span>
- </div>
- {{/notEq}}{{/if}}
- </div>
- {{/each}}
-
- </td>
- {{/unless}}
-
- {{#if canWrite}}
- <td class="coding-rules-detail-quality-profile-actions">
- <div class="button-group">
- {{#unless isTemplate}}
- <button class="coding-rules-detail-quality-profile-change">{{t 'change_verb'}}</button>
- {{/unless}}
- {{#if parent}}
- {{#eq inherit 'OVERRIDES'}}
- <button class="coding-rules-detail-quality-profile-revert button-red">
- {{t 'coding_rules.revert_to_parent_definition'}}
- </button>
- {{/eq}}
- {{else}}
- <button class="coding-rules-detail-quality-profile-deactivate button-red">
- {{t 'coding_rules.deactivate'}}
- </button>
- {{/if}}
- </div>
- </td>
- {{/if}}
-
- {{else}}
- {{#if canWrite}}{{#unless isTemplate}}
- <td class="coding-rules-detail-quality-profile-actions">
- <div class="button-group">
- <button class="coding-rules-detail-quality-profile-activate">{{t 'coding_rules.activate'}}</button>
- </div>
- </td>
- {{/unless}}{{/if}}
- {{/if}}
- </tr>
- </tbody>
-</table>
+++ /dev/null
-<div class="coding-rules-detail-context"></div>
-
-<h3 class="coding-rules-detail-header">
- {{name}}
- <a class="coding-rules-detail-permalink" href="#rule_key={{key}}">
- <i class="icon-link"></i> {{t 'coding_rules.permalink'}}
- </a>
-</h3>
-<span class="subtitle">{{key}}</span>
-
-<ul class="coding-rules-detail-properties">
- {{#unless isManual}}
- <li class="coding-rules-detail-property">{{severityIcon severity}} {{t "severity" severity}}</li>
- {{/unless}}
- {{#notEq status 'READY'}}
- <li class="coding-rules-detail-property">
- <span class="coding-rules-detail-status coding-rules-detail-not-ready">{{status}}</span>
- </li>
- {{/notEq}}
-
-
- <li class="coding-rules-detail-property coding-rules-detail-tag-list {{#if canWrite}}coding-rules-detail-tags-change{{/if}}">
- <i class="icon-tags"></i>
- <span>{{#if allTags}}{{join allTags ', '}}{{else}}{{t 'coding_rules.no_tags'}}{{/if}}</span>
- </li>
- {{#if canWrite}}<li class="coding-rules-detail-property coding-rules-detail-tag-edit">
- {{#if sysTags}}<i class="icon-tags"></i>
- <span>{{join sysTags ', '}}</span>{{/if}}
- <input class="coding-rules-detail-tag-input" type="text" value="{{#if tags}}{{join tags ','}}{{/if}}">
-
- <div class="button-group">
- <button class="coding-rules-detail-tag-edit-done">{{t 'Done'}}</button>
- </div>
- <a class="coding-rules-details-tag-edit-cancel">{{t 'cancel'}}</a>
- </li>{{/if}}
-
- {{#if subcharacteristic}}
- <li class="coding-rules-detail-property coding-rules-subcharacteristic">{{subcharacteristic}}</li>
- {{/if}}
- <li class="coding-rules-detail-property">{{t 'coding_rules.available_since'}} {{d createdAt}}</li>
- <li class="coding-rules-detail-property">{{repository}}{{#unless isManual}} ({{language}}){{/unless}}</li>
-
- {{#if isTemplate}}
- <li class="coding-rules-detail-property" title="{{t 'coding_rules.rule_template.title'}}">{{t 'coding_rules.rule_template'}}</li>
- {{/if}}
- {{#if templateKey}}
- <li class="coding-rules-detail-property" title="{{t 'coding_rules.custom_rule.title'}}">{{t 'coding_rules.custom_rule'}}
- (<a href="#rule_key={{templateKey}}">{{t 'coding_rules.show_template'}}</a>)
- </li>
- {{/if}}
-</ul>
-
-<div class="coding-rules-detail-description rule-desc markdown">{{{htmlDesc}}}</div>
-
-{{#unless isEditable}}
- {{#unless isManual}}
- <div class="coding-rules-detail-description coding-rules-detail-description-extra">
- <div id="coding-rules-detail-description-extra">
- {{#if htmlNote}}
- <div class="rule-desc marginbottom10 markdown">{{{htmlNote}}}</div>{{/if}}
- {{#if canWrite}}<div class="button-group">
- <button id="coding-rules-detail-extend-description">{{t 'coding_rules.extend_description'}}</button>
- </div>{{/if}}
- </div>
-
- {{#if canWrite}}<div class="coding-rules-detail-extend-description-form">
- <table class="width100">
- <tbody>
- <tr>
- <td class="width100" colspan="2">
- <textarea id="coding-rules-detail-extend-description-text" rows="4"
- style="width: 100%; margin-bottom: 4px;">{{mdNote}}</textarea>
- </td>
- </tr>
- <tr>
- <td>
- <div class="button-group">
- <button id="coding-rules-detail-extend-description-submit">{{t 'save'}}</button>
- {{#if mdNote}}
- <button id="coding-rules-detail-extend-description-remove" class="button-red">{{t 'remove'}}</button>
- {{/if}}
- </div>
- <a id="coding-rules-detail-extend-description-cancel" class="action">{{t 'cancel'}}</a>
- </td>
- <td class="right">
- {{> '_markdown-tips' }}
- </td>
- </tr>
- </tbody>
- </table>
- </div>
-
- <div id="coding-rules-detail-extend-description-spinner">
- <i class="spinner"></i>
- </div>{{/if}}
- </div>
- {{/unless}}
-{{/unless}}
-
-
-{{#if params}}
- <h3 class="coding-rules-detail-title">{{t 'coding_rules.parameters'}}</h3>
- <div class="coding-rules-detail-parameters">
- {{#each params}}
- <dl class="coding-rules-detail-parameter">
- <dt class="coding-rules-detail-parameter-name">{{key}}</dt>
- <dd class="coding-rules-detail-parameter-description" data-key="{{key}}">
- <p>{{{htmlDesc}}}</p>
- {{#if ../../templateKey}}
- <div class="subtitle">
- {{#if defaultValue }}
- <span class="value">{{defaultValue}}</span>
- {{else}}
- {{t 'coding_rules.parameter.empty'}}
- {{/if}}
- </div>
- {{else}}
- {{#if defaultValue}}
- <div class="subtitle">{{t 'coding_rules.parameters.default_value'}} <span class="value">{{defaultValue}}</span></div>
- {{/if}}
- {{/if}}
- </dd>
- </dl>
- {{/each}}
- </div>
-{{/if}}
-
-{{#if isEditable}}
- <div class="coding-rules-detail-description">
- <div class="button-group">
- {{#if isManual}}
- <button id="coding-rules-detail-manual-rule-change">{{t 'edit'}}</button>
- {{else}}
- <button id="coding-rules-detail-custom-rule-change">{{t 'edit'}}</button>
- {{/if}}
- <button id="coding-rules-detail-rule-delete" class="button-red">{{t 'delete'}}</button>
- </div>
- </div>
-{{/if}}
-
-
-{{#if isTemplate}}
-<div class="coding-rules-detail-custom-rules-section">
- <h3 class="coding-rules-detail-title">{{t 'coding_rules.custom_rules'}}</h3>
-
- {{#if canWrite}}<div class="button-group coding-rules-detail-quality-profiles-activation">
- <button id="coding-rules-custom-rules-create">{{t 'coding_rules.create'}}</button>
- </div>{{/if}}
- <div id="coding-rules-detail-custom-rules"></div>
-</div>
-{{/if}}
-
-
-{{#if qualityProfilesVisible}}
-<div class="coding-rules-detail-quality-profiles-section">
- <h3 class="coding-rules-detail-title">{{t 'coding_rules.quality_profiles'}}</h3>
-
- {{#if canWrite}}{{#unless isTemplate}}<div class="button-group coding-rules-detail-quality-profiles-activation">
- <button id="coding-rules-quality-profile-activate">{{t 'coding_rules.activate'}}</button>
- </div>{{/unless}}{{/if}}
- {{#if isTemplate}}
- <div class="coding-rules-detail-quality-profiles-template-caption warning">{{t 'coding_rules.quality_profiles.template_caption'}}</div>
- {{/if}}
- <div id="coding-rules-detail-quality-profiles"></div>
-</div>
-{{/if}}
+++ /dev/null
-<div class="navigator-facets-list">
- {{#unless items}}
- {{t 'coding_rules.no_results'}}
- {{/unless}}
- {{#each items}}
- <div class="navigator-facets-list-item" data-property="{{property}}">
- <div class="navigator-facets-list-item-name">
- {{#if limitReached}}
- {{tp 'coding_rules.facets.top' property_message}}
- {{else}}
- {{property_message}}
- {{/if}}
- </div>
- <div class="navigator-facets-list-item-options">
- {{#each values}}
- {{#if count}}
- <a class="facet" data-key="{{val}}" data-property="{{../property}}">
- <span class="facet-name">{{text}}</span>
- <span class="facet-stat">{{count}}</span>
- </a>
- {{/if}}
- {{/each}}
- </div>
- </div>
- {{/each}}
-</div>
+++ /dev/null
-<div class="navigator-filters-list"></div>
-<button class="navigator-filter-submit">{{t 'search_verb'}}</button>
\ No newline at end of file
+++ /dev/null
-<h1 class="navigator-header-title">{{t 'coding_rules.page'}}</h1>
-
-<div class="navigator-header-actions button-group">
- <button id="coding-rules-new-search">{{t 'coding_rules.new_search'}}</button>
- {{#if canWrite}}<button id="coding-rules-create-rule">{{t 'coding_rules.create'}}</button>{{/if}}
-</div>
+++ /dev/null
-<div class="navigator-header"></div>
-<div class="navigator-filters"></div>
-<div class="navigator-facets"></div>
-
-<div class="navigator-content">
- <div class="navigator-side">
- <div style="position:relative; overflow: visible; height: 100%;">
- <div class="navigator-actions"></div>
- <div class="navigator-results"></div>
- <a class="navigator-resizer"><i class="icon-resizer"></i></a>
- </div>
- </div>
- <div class="navigator-main">
- <div class="navigator-details"></div>
- </div>
-</div>
\ No newline at end of file
+++ /dev/null
-{{t 'coding_rules.no_results'}}
\ No newline at end of file
+++ /dev/null
-<div class="line line-small">
- <span class="coding-rules-detail-status">{{default language manualRuleLabel}}</span>
-
- {{#if allTags}}
-
- <span class="coding-rules-list-tags">
- <i class="icon-tags"></i>
- <span>{{join allTags ', '}}</span>
- </span>
- {{/if}}
-
- {{#notEq status 'READY'}}
- <div class="line-right">
- <span class="coding-rules-detail-not-ready">{{status}}</span>
- </div>
- {{/notEq}}
-</div>
-
-<div class="line" title="{{name}}" name="{{key}}">{{name}}</div>
+++ /dev/null
-<form>
- <div class="modal-head">
- {{#if change}}
- <h2>{{t 'coding_rules.update_manual_rule'}}</h2>
- {{else}}
- <h2>{{t 'coding_rules.create_manual_rule'}}</h2>
- {{/if}}
- </div>
-
- <div class="modal-body">
- <div class="modal-error"></div>
- <div class="modal-warning">{{t 'coding_rules.reactivate.help'}}</div>
-
- <table>
- <tr class="property">
- <th><h3>{{t 'name'}} <em class="mandatory">*</em></h3></th>
- <td>
- <input type="text" name="name" id="coding-rules-manual-rule-creation-name"
- class="coding-rules-name-key" value="{{name}}"/>
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'key'}}{{#unless change}} <em class="mandatory">*</em>{{/unless}}</h3></th>
- <td>
- {{#if change}}
- {{key}}
- {{else}}
- <input type="text" name="key" id="coding-rules-manual-rule-creation-key"
- class="coding-rules-name-key" value="{{internalKey}}"/>
- {{/if}}
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'description'}} <em class="mandatory">*</em></h3></th>
- <td>
- <textarea type="textarea" name="markdown_description" id="coding-rules-manual-rule-creation-html-description"
- class="coding-rules-markdown-description" rows="15">{{{mdDesc}}}</textarea>
- <span class="right">{{> '_markdown-tips' }}</span>
- </td>
- </tr>
- </table>
- </div>
-
- <div class="modal-foot">
- <button id="coding-rules-manual-rule-creation-create">
- {{#if change}}{{t 'save'}}{{else}}{{t 'create'}}{{/if}}
- </button>
- <a id="coding-rules-manual-rule-creation-cancel" class="action">{{t 'cancel'}}</a>
- </div>
-</form>
+++ /dev/null
-<button id="coding-rules-manual-rule-creation-reactivate">
- {{t 'coding_rules.reactivate'}}
-</button>
-<button id="coding-rules-manual-rule-creation-create">
- {{#if change}}{{t 'save'}}{{else}}{{t 'create'}}{{/if}}
-</button>
-<a id="coding-rules-manual-rule-creation-cancel" class="action">{{t 'cancel'}}</a>
+++ /dev/null
-<div class="coding-rules-parameter-full-description bubble-popup-container">
- <div class="bubble-popup-title">{{key}}</div>
-
- {{{htmlDesc}}}
- {{#if defaultValue}}
- <div>
- {{t 'coding_rules.parameters.default_value'}} {{defaultValue}}
- </div>
- {{/if}}
-</div>
-
-<div class="bubble-popup-arrow"></div>
+++ /dev/null
-<li>
- <label title="{{id}}" data-id="{{id}}">
- <span>
- <i class="icon-checkbox {{#if checked}}icon-checkbox-checked{{/if}} {{#unless multiple}}icon-checkbox-single{{/unless}}"></i>
- {{text}}
- </span>
-
- {{#if language}}
- <br>
- <span>
- <i class="icon-checkbox icon-checkbox-invisible"></i>
- <span class="subtitle">{{language}}</span>
- </span>
- {{/if}}
- </label>
-</li>
+++ /dev/null
-<form>
- <div class="modal-head">
- {{#if change}}
- <h2>{{t 'coding_rules.change_details'}}</h2>
- {{else}}
- <h2>{{t 'coding_rules.activate_in_quality_profile'}}</h2>
- {{/if}}
- </div>
-
- <div class="modal-body modal-body-select2">
- <div class="modal-error"></div>
-
- <table>
- <tr class="property">
- <th><h3>{{t 'coding_rules.quality_profile'}}</h3></th>
- <td>
- {{#if key}}
- {{name}}
- {{else}}
- <select id="coding-rules-quality-profile-activation-select">
- {{#each qualityProfiles}}
- <option value="{{key}}">{{name}}</option>
- {{/each}}
- </select>
- {{/if}}
- </td>
- </tr>
- <tr class="property">
- <th><h3>{{t 'severity'}}</h3></th>
- <td>
- <select id="coding-rules-quality-profile-activation-severity">
- {{#each severities}}
- <option value="{{this}}">{{t 'severity' this}}</option>
- {{/each}}
- </select>
- </td>
- </tr>
- {{#if isCustomRule}}
- <tr class="property">
- <td colspan="2" class="note">{{t 'coding_rules.custom_rule.activation_notice'}}</td>
- {{else}}
- {{#each params}}
- <tr class="property">
- <th><h3>{{key}}</h3></th>
- <td>
- {{#eq type 'TEXT'}}
- <textarea class="width100" rows="3" name="{{key}}" placeholder="{{defaultValue}}">{{value}}</textarea>
- {{else}}
- {{#eq type 'BOOLEAN'}}
- <select name="{{key}}" value="{{value}}">
- <option value="{{defaultValue}}">{{t 'default'}} ({{t defaultValue}})</option>
- <option value="true"{{#eq value 'true'}} selected="selected"{{/eq}}>{{t 'true'}}</option>
- <option value="false"{{#eq value 'false'}} selected="selected"{{/eq}}>{{t 'false'}}</option>
- </select>
- {{else}}
- <input type="text" name="{{key}}" value="{{value}}" placeholder="{{defaultValue}}">
- {{/eq}}
- {{/eq}}
- <div class="note">{{description}}</div>
- {{#if extra}}
- <div class="note">{{extra}}</div>
- {{/if}}
- </td>
- </tr>
- {{/each}}
- {{/if}}
- </table>
- </div>
-
- <div class="modal-foot">
- <button id="coding-rules-quality-profile-activation-activate" {{#unless saveEnabled}}disabled="disabled"{{/unless}}>
- {{#if change}}{{t 'save'}}{{else}}{{t 'coding_rules.activate'}}{{/if}}
- </button>
- <a id="coding-rules-quality-profile-activation-cancel" class="action">{{t 'cancel'}}</a>
- </div>
-</form>
+++ /dev/null
-<input type="text"
- size="{{size}}" name="{{property}}" value="{{value}}"
- class="query-filter-input"/>
+++ /dev/null
-<li>
- <label title="{{id}}" data-id="{{id}}">
- <span>
- <i class="icon-checkbox {{#if checked}}icon-checkbox-checked{{/if}} {{#unless multiple}}icon-checkbox-single{{/unless}}"></i>
- {{text}}
- </span>
-
- {{#if language}}
- <br>
- <span>
- <i class="icon-checkbox icon-checkbox-invisible"></i>
- <span class="subtitle">{{language}}</span>
- </span>
- {{/if}}
- </label>
-</li>
+++ /dev/null
-var lib = require('../lib'),
- testName = lib.testName('Coding Rules');
-
-
-lib.initMessages();
-lib.changeWorkingDirectory('coding-rules-spec');
-
-
-casper.test.begin(testName('Admin Tests'), function suite(test) {
-
- var showId = null;
- var updateId = null;
-
- casper.start(lib.buildUrl('coding-rules-old'), function() {
- lib.mockRequest('/api/l10n/index', '{}');
- lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
- lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
- lib.mockRequestFromFile('/api/rules/search', 'search_initial.json');
- showId = lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
- });
-
-
- casper.waitWhileSelector("div#coding-rules-page-loader", function checkInitialPageLoad() {
-
- casper.waitForSelector('.navigator-header', function checkAdminHeader() {
- test.assertExist('button#coding-rules-create-rule');
- });
-
-
- casper.waitForSelector('h3.coding-rules-detail-header', function showFirstRule() {
- test.assertSelectorHasText('.coding-rules-detail-description-extra', 'Xoo shall not pass');
-
- test.assertExists('button#coding-rules-detail-extend-description');
- });
-
-
- casper.then(function editNote() {
- casper.click('button#coding-rules-detail-extend-description');
- test.assertSelectorHasText('textarea#coding-rules-detail-extend-description-text', 'As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!');
-
- casper.sendKeys('textarea#coding-rules-detail-extend-description-text', 'Xoo must pass');
-
- updateId = lib.mockRequestFromFile('/api/rules/update', 'edit_note_x1.json');
- casper.click('button#coding-rules-detail-extend-description-submit');
-
- casper.wait(500, function showUpdatedRule() {
- test.assertSelectorHasText('.coding-rules-detail-description-extra', 'Xoo must pass');
- });
-
- });
- });
-
- casper.run(function() {
- test.done();
- });
-});
-
-
-casper.test.begin(testName('Activation Tests'), function suite(test) {
-
- var showId = null;
- var activateId = null;
-
- casper.start(lib.buildUrl('coding-rules-old#rule_key=squid-xoo:x1'), function() {
- lib.clearRequestMocks();
- lib.mockRequest('/api/l10n/index', '{}');
- lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
- lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
- lib.mockRequestFromFile('/api/rules/search', 'search_x1.json');
- showId = lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
- });
-
-
- casper.waitWhileSelector("div#coding-rules-page-loader", function checkRuleActivation() {
-
- casper.waitForSelector('div.coding-rules-detail-quality-profiles-section', function showRuleActivation() {
- test.assertExists('#coding-rules-detail-quality-profiles');
-
- test.assertElementCount('.coding-rules-detail-quality-profile', 1);
-
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', 'A nice');
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', 'true');
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', '0');
- });
-
-
- casper.then(function editActiveRule() {
- casper.click('button.coding-rules-detail-quality-profile-change');
-
- casper.waitForSelector('button#coding-rules-quality-profile-activation-activate', function checkActivationPopup() {
- test.assertElementCount('.modal-body .property', 5 /* quality profile, severity, 3 parameters */);
-
- test.assertSelectorHasText('.modal-body .property textarea[name="textParameter"]', 'A nice\ntext parameter\nwith newlines.');
- test.assertSelectorHasText('.modal-body .property input[name="skipLines"]', '');
- test.assertEval(function checkPlaceHolder() {
- return $j('.modal-body .property input[name="skipLines"]').attr('placeholder') === '0'
- });
- test.assertEval(function checkTrueIsSelected() {
- return $j('.modal-body .property select[name="acceptWhitespace"]').val() === 'true'
- });
- });
- });
-
- casper.then(function updateParameters() {
- casper.sendKeys('textarea[name="textParameter"]', '\nUpdated');
- casper.sendKeys('input[name="skipLines"]', '5');
- casper.evaluate(function selectDefault() {
- $j('select[name="acceptWhitespace"]').val('false').change();
- });
-
- lib.clearRequestMock(showId);
- showId = lib.mockRequestFromFile('/api/rules/show', 'update_parameters_x1.json');
- activateId = lib.mockRequest('/api/qualityprofiles/activate_rule', '');
-
- casper.click('button#coding-rules-quality-profile-activation-activate');
-
- casper.wait(500, function showUpdatedParameters() {
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', 'A nice');
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', 'false');
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', '5');
- });
-
- });
-
- casper.then(function deactivateRule() {
- casper.click('button.coding-rules-detail-quality-profile-deactivate');
-
- casper.waitForSelector('button[data-confirm="yes"]', function checkConfirmPopup() {
- lib.clearRequestMock(showId);
- showId = lib.mockRequestFromFile('/api/rules/show', 'deactivate_x1.json');
- lib.mockRequest('/api/qualityprofiles/deactivate_rule', '');
-
- casper.click('button[data-confirm="yes"]');
- });
-
- casper.wait(500, function showUpdatedParameters() {
- test.assertElementCount('.coding-rules-detail-quality-profile', 0);
- });
- });
-
- casper.then(function activateRule() {
- casper.click('button#coding-rules-quality-profile-activate');
-
- casper.waitForSelector('button#coding-rules-quality-profile-activation-activate', function checkActivationPopup() {
-
- lib.clearRequestMock(showId);
- showId = lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
- lib.clearRequestMock(activateId);
- activateId = lib.mockRequest('/api/qualityprofiles/activate_rule', '');
-
- casper.click('button#coding-rules-quality-profile-activation-activate');
-
- casper.wait(500, function showUpdatedParameters() {
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', 'A nice');
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', 'true');
- test.assertSelectorHasText('.coding-rules-detail-quality-profile-parameter', '0');
- });
-
- });
-
- });
-
- });
-
-
- casper.run(function() {
- test.done();
- });
-});
-
-
-casper.test.begin(testName('Tag Navigation Test'), function suite(test) {
-
- casper.start(lib.buildUrl('coding-rules-old#tags=polop,bug,pilip,unused,palap'), function() {
- lib.clearRequestMocks();
- lib.mockRequest('/api/l10n/index', '{}');
- lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
- lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
- lib.mockRequestFromFile('/api/rules/search', 'search_x1.json');
- lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
- });
-
-
- casper.waitWhileSelector("div#coding-rules-page-loader", function checkTagFilterRestored() {
- casper.waitForSelector('.navigator-filters', function checkDefaultFilters() {
- test.assertElementCount('.navigator-filter-disabled', 11 /* Tag is enabled */);
- test.assertSelectorHasText('.navigator-filter[data-property="tags"] .navigator-filter-value', 'bug, unused');
- });
- });
-
- casper.run(function() {
- test.done();
- });
-});
+++ /dev/null
-{
- "canWrite": false,
- "qualityprofiles": [
- {
- "key": "xoo-sonar-way",
- "name": "Sonar way",
- "lang": "xoo"
- },
- {
- "key": "xoo-empty",
- "name": "Empty",
- "lang": "xoo"
- },
- {
- "key": "java-sonar-way",
- "name": "Sonar way",
- "lang": "java"
- },
- {
- "key": "coffee-sonar-way",
- "name": "Sonar way",
- "lang": "coffee"
- },
- {
- "key": "java-sonar-way-with-findbugs",
- "name": "Sonar way with Findbugs",
- "lang": "java",
- "parentKey": "java-sonar-way"
- }
- ],
- "languages": {
- "xoo": "Xoo",
- "java": "Java",
- "coffee": "CoffeeScript"
- },
- "repositories": [
- {
- "key": "squid",
- "name": "SonarQube",
- "language": "java"
- },
- {
- "key": "squid-xoo",
- "name": "SonarQube",
- "language": "xoo"
- },
- {
- "key": "squid-coffee",
- "name": "SonarQube",
- "language": "coffee"
- },
- {
- "key": "common-coffee",
- "name": "Common SonarQube",
- "language": "coffee"
- },
- {
- "key": "common-java",
- "name": "Common SonarQube",
- "language": "java"
- }
- ],
- "statuses": {
- "BETA": "Beta",
- "DEPRECATED": "Deprecated",
- "READY": "Ready"
- },
- "characteristics": {
- "UNDERSTANDABILITY": "Maintainability: Understandability",
- "MAINTAINABILITY": "Maintainability",
- "TIME_ZONE_RELATED_PORTABILITY": "Portability: Time zone related portability",
- "READABILITY": "Maintainability: Readability",
- "SECURITY_FEATURES": "Security: Security features",
- "ARCHITECTURE_RELIABILITY": "Reliability: Architecture related reliability",
- "OS_RELATED_PORTABILITY": "Portability: OS related portability",
- "EXCEPTION_HANDLING": "Reliability: Exception handling",
- "LOGIC_CHANGEABILITY": "Changeability: Logic related changeability",
- "SOFTWARE_RELATED_PORTABILITY": "Portability: Software related portability",
- "INPUT_VALIDATION_AND_REPRESENTATION": "Security: Input validation and representation",
- "LANGUAGE_RELATED_PORTABILITY": "Portability: Language related portability",
- "ERRORS": "Security: Errors",
- "SECURITY": "Security",
- "RELIABILITY": "Reliability",
- "PORTABILITY": "Portability",
- "HARDWARE_RELATED_PORTABILITY": "Portability: Hardware related portability",
- "SYNCHRONIZATION_RELIABILITY": "Reliability: Synchronization related reliability",
- "TRANSPORTABILITY": "Reusability: Transportability",
- "COMPILER_RELATED_PORTABILITY": "Portability: Compiler related portability",
- "RESOURCE_RELIABILITY": "Reliability: Resource",
- "CPU_EFFICIENCY": "Efficiency: Processor use",
- "EFFICIENCY": "Efficiency",
- "CHANGEABILITY": "Changeability",
- "DATA_CHANGEABILITY": "Changeability: Data related changeability",
- "API_ABUSE": "Security: API abuse",
- "ARCHITECTURE_CHANGEABILITY": "Changeability: Architecture related changeability",
- "UNIT_TESTS": "Reliability: Unit tests",
- "INSTRUCTION_RELIABILITY": "Reliability: Instruction related reliability",
- "REUSABILITY": "Reusability",
- "MODULARITY": "Reusability: Modularity",
- "UNIT_TESTABILITY": "Testability: Unit level testability",
- "TESTABILITY": "Testability",
- "INTEGRATION_TESTABILITY": "Testability: Integration level testability",
- "NETWORK_USE": "Efficiency: Network use",
- "MEMORY_EFFICIENCY": "Efficiency: Memory use",
- "DATA_RELIABILITY": "Reliability: Data related reliability",
- "FAULT_TOLERANCE": "Reliability: Fault tolerance",
- "LOGIC_RELIABILITY": "Reliability: Logic related reliability"
- }
-}
+++ /dev/null
-{
- "canWrite": true,
- "qualityprofiles": [
- {
- "key": "xoo-sonar-way",
- "name": "Sonar way",
- "lang": "xoo"
- },
- {
- "key": "xoo-empty",
- "name": "Empty",
- "lang": "xoo"
- },
- {
- "key": "java-sonar-way",
- "name": "Sonar way",
- "lang": "java"
- },
- {
- "key": "coffee-sonar-way",
- "name": "Sonar way",
- "lang": "coffee"
- },
- {
- "key": "java-sonar-way-with-findbugs",
- "name": "Sonar way with Findbugs",
- "lang": "java",
- "parentKey": "java-sonar-way"
- }
- ],
- "languages": {
- "xoo": "Xoo",
- "java": "Java",
- "coffee": "CoffeeScript"
- },
- "repositories": [
- {
- "key": "squid",
- "name": "SonarQube",
- "language": "java"
- },
- {
- "key": "squid-xoo",
- "name": "SonarQube",
- "language": "xoo"
- },
- {
- "key": "squid-coffee",
- "name": "SonarQube",
- "language": "coffee"
- },
- {
- "key": "common-coffee",
- "name": "Common SonarQube",
- "language": "coffee"
- },
- {
- "key": "common-java",
- "name": "Common SonarQube",
- "language": "java"
- }
- ],
- "statuses": {
- "BETA": "Beta",
- "DEPRECATED": "Deprecated",
- "READY": "Ready"
- },
- "characteristics": {
- "UNDERSTANDABILITY": "Maintainability: Understandability",
- "MAINTAINABILITY": "Maintainability",
- "TIME_ZONE_RELATED_PORTABILITY": "Portability: Time zone related portability",
- "READABILITY": "Maintainability: Readability",
- "SECURITY_FEATURES": "Security: Security features",
- "ARCHITECTURE_RELIABILITY": "Reliability: Architecture related reliability",
- "OS_RELATED_PORTABILITY": "Portability: OS related portability",
- "EXCEPTION_HANDLING": "Reliability: Exception handling",
- "LOGIC_CHANGEABILITY": "Changeability: Logic related changeability",
- "SOFTWARE_RELATED_PORTABILITY": "Portability: Software related portability",
- "INPUT_VALIDATION_AND_REPRESENTATION": "Security: Input validation and representation",
- "LANGUAGE_RELATED_PORTABILITY": "Portability: Language related portability",
- "ERRORS": "Security: Errors",
- "SECURITY": "Security",
- "RELIABILITY": "Reliability",
- "PORTABILITY": "Portability",
- "HARDWARE_RELATED_PORTABILITY": "Portability: Hardware related portability",
- "SYNCHRONIZATION_RELIABILITY": "Reliability: Synchronization related reliability",
- "TRANSPORTABILITY": "Reusability: Transportability",
- "COMPILER_RELATED_PORTABILITY": "Portability: Compiler related portability",
- "RESOURCE_RELIABILITY": "Reliability: Resource",
- "CPU_EFFICIENCY": "Efficiency: Processor use",
- "EFFICIENCY": "Efficiency",
- "CHANGEABILITY": "Changeability",
- "DATA_CHANGEABILITY": "Changeability: Data related changeability",
- "API_ABUSE": "Security: API abuse",
- "ARCHITECTURE_CHANGEABILITY": "Changeability: Architecture related changeability",
- "UNIT_TESTS": "Reliability: Unit tests",
- "INSTRUCTION_RELIABILITY": "Reliability: Instruction related reliability",
- "REUSABILITY": "Reusability",
- "MODULARITY": "Reusability: Modularity",
- "UNIT_TESTABILITY": "Testability: Unit level testability",
- "TESTABILITY": "Testability",
- "INTEGRATION_TESTABILITY": "Testability: Integration level testability",
- "NETWORK_USE": "Efficiency: Network use",
- "MEMORY_EFFICIENCY": "Efficiency: Memory use",
- "DATA_RELIABILITY": "Reliability: Data related reliability",
- "FAULT_TOLERANCE": "Reliability: Fault tolerance",
- "LOGIC_RELIABILITY": "Reliability: Logic related reliability"
- }
-}
+++ /dev/null
-{
-
- "rule": {
- "key": "squid-xoo:x1",
- "repo": "squid-xoo",
- "name": "No empty line",
- "createdAt": "2014-07-23T11:17:26+0200",
- "severity": "MINOR",
- "status": "BETA",
- "isTemplate": false,
- "tags": [ ],
- "sysTags": [
- "convention",
- "pitfall"
- ],
- "lang": "xoo",
- "langName": "Xoo",
- "htmlDesc": "Generate an issue on <em>empty</em> lines of Xoo source files",
- "mdDesc": "Generate an issue on *empty* lines of Xoo source files",
- "noteLogin": "admin",
- "mdNote": "As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!",
- "htmlNote": "As per the <a href=\"http://xoo.sonarsource.com/book\" target=\"_blank\">Book of Xoo</a>:<br/><blockquote>Xoo shall not pass!<br/></blockquote>",
- "defaultDebtChar": "TESTABILITY",
- "defaultDebtSubChar": "INTEGRATION_TESTABILITY",
- "debtChar": "TESTABILITY",
- "debtSubChar": "INTEGRATION_TESTABILITY",
- "debtCharName": "Testability",
- "debtSubCharName": "Integration level",
- "debtRemFnType": "LINEAR_OFFSET",
- "debtRemFnCoeff": "1h",
- "debtRemFnOffset": "30min",
- "defaultDebtRemFnType": "LINEAR_OFFSET",
- "defaultDebtRemFnCoeff": "1h",
- "defaultDebtRemFnOffset": "30min",
- "effortToFixDescription": "Effort to fix issue on one line",
- "debtOverloaded": false,
- "params": [
- {
- "key": "acceptWhitespace",
- "htmlDesc": "<h1>Accept whitespace (<code>\\s|\\t</code>) on the line\n</h1>This property is available so that a line containing only whitespace is not considered empty.<br/><h2>Example with property set to ``false``\n</h2><pre lang=\"xoo\"><code> <- One issue here\n<- And one here</code></pre><br/><br/><h2>Example with property set to ``true``\n</h2><pre lang=\"xoo\"><code> <- No issue here\n<- But one here</code></pre><br/>",
- "type": "BOOLEAN",
- "defaultValue": "false"
- },
- {
- "key": "textParameter",
- "htmlDesc": "This is a parameter of type TEXT",
- "type": "TEXT",
- "defaultValue": "false"
- },
- {
- "key": "skipLines",
- "htmlDesc": "Skip a number of lines at the beginning of the file",
- "type": "INTEGER",
- "defaultValue": "0"
- }
- ]
- },
- "actives": [ ]
-
-}
+++ /dev/null
-{
- "rule": {
- "key": "squid-xoo:x1",
- "repo": "squid-xoo",
- "name": "No empty line",
- "createdAt": "2014-07-23T11:17:26+0200",
- "severity": "MINOR",
- "status": "BETA",
- "isTemplate": false,
- "tags": [ ],
- "sysTags": [
- "convention",
- "pitfall"
- ],
- "lang": "xoo",
- "langName": "Xoo",
- "htmlDesc": "Generate an issue on <em>empty</em> lines of Xoo source files",
- "mdDesc": "Generate an issue on *empty* lines of Xoo source files",
- "noteLogin": "admin",
- "mdNote": "As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!Xoo must pass",
- "htmlNote": "As per the <a href=\"http://xoo.sonarsource.com/book\" target=\"_blank\">Book of Xoo</a>:<br/><blockquote>Xoo shall not pass!Xoo must pass</blockquote>",
- "defaultDebtChar": "TESTABILITY",
- "defaultDebtSubChar": "INTEGRATION_TESTABILITY",
- "debtChar": "TESTABILITY",
- "debtSubChar": "INTEGRATION_TESTABILITY",
- "debtCharName": "Testability",
- "debtSubCharName": "Integration level",
- "debtRemFnType": "LINEAR_OFFSET",
- "debtRemFnCoeff": "1h",
- "debtRemFnOffset": "30min",
- "defaultDebtRemFnType": "LINEAR_OFFSET",
- "defaultDebtRemFnCoeff": "1h",
- "defaultDebtRemFnOffset": "30min",
- "effortToFixDescription": "Effort to fix issue on one line",
- "debtOverloaded": false,
- "params": [
- {
- "key": "acceptWhitespace",
- "htmlDesc": "<h1>Accept whitespace (<code>\\s|\\t</code>) on the line\n</h1>This property is available so that a line containing only whitespace is not considered empty.<br/><h2>Example with property set to ``false``\n</h2><pre lang=\"xoo\"><code> <- One issue here\n<- And one here</code></pre><br/><br/><h2>Example with property set to ``true``\n</h2><pre lang=\"xoo\"><code> <- No issue here\n<- But one here</code></pre><br/>",
- "defaultValue": "false"
- }
- ]
- },
- "actives": [
- {
- "qProfile": "xoo-sonar-way",
- "inherit": "NONE",
- "severity": "MAJOR",
- "params": [
- {
- "key": "acceptWhitespace",
- "value": "true"
- }
- ]
- }
- ]
-
-}
+++ /dev/null
-{
-
- "total": 10,
- "p": 1,
- "ps": 25,
- "rules": [
- {
- "key": "squid-xoo:x1",
- "name": "No empty line",
- "lang": "xoo",
- "status": "BETA"
- },
- {
- "key": "squid:S0001",
- "name": "Deprecated rule",
- "lang": "java",
- "status": "DEPRECATED"
- },
- {
- "key": "squid-coffee:S0001",
- "name": "First rule of Coffee is: you don't talk about Coffee",
- "lang": "coffee",
- "status": "READY"
- },
- {
- "key": "squid-coffee:S0002",
- "name": "Second rule of Coffee is: you DO NOT talk about Coffee",
- "lang": "coffee",
- "status": "READY"
- },
- {
- "key": "common-coffee:TrailingWhitespace",
- "name": "Avoid trailing whitespace on lines",
- "lang": "coffee",
- "status": "READY"
- },
- {
- "key": "squid:S0002",
- "name": "Deprecating rule",
- "lang": "java",
- "status": "READY"
- },
- {
- "key": "squid:S0003",
- "name": "Always put a newline at end of file",
- "lang": "java",
- "status": "READY"
- },
- {
- "key": "common-java:TrailingWhitespace",
- "name": "Avoid trailing whitespace on lines",
- "lang": "java",
- "status": "READY"
- },
- {
- "key": "common-java:ConvertSingleMethodInterfacesToLambdas",
- "name": "Single method interfaces should be converted to lambdas",
- "lang": "java",
- "status": "READY"
- },
- {
- "key": "common-java:LambdaOneStatementBlock",
- "name": "Lamdbas containing only one statement should not nest this statement in a block ",
- "lang": "java",
- "status": "READY"
- }
- ],
- "facets": [
- {
- "property": "tags",
- "values": [
- {
- "val": "java8",
- "count": 5
- },
- {
- "val": "pitfall",
- "count": 4
- },
- {
- "val": "convention",
- "count": 3
- },
- {
- "val": "multithreading",
- "count": 1
- }
- ]
- },
- {
- "property": "languages",
- "values": [
- {
- "val": "java",
- "count": 6
- },
- {
- "val": "coffee",
- "count": 3
- },
- {
- "val": "xoo",
- "count": 1
- }
- ]
- },
- {
- "property": "repositories",
- "values": [
- {
- "val": "squid",
- "count": 3
- },
- {
- "val": "common-java",
- "count": 3
- },
- {
- "val": "squid-coffee",
- "count": 2
- },
- {
- "val": "common-coffee",
- "count": 1
- },
- {
- "val": "squid-xoo",
- "count": 1
- }
- ]
- }
- ]
-}
+++ /dev/null
-{
-
- "total": 1,
- "p": 1,
- "ps": 25,
- "rules": [
- {
- "key": "squid-xoo:x1",
- "name": "No empty line",
- "lang": "xoo",
- "status": "BETA"
- }
- ],
- "facets": [
- {
- "property": "tags",
- "values": [
- {
- "val": "pitfall",
- "count": 1
- },
- {
- "val": "convention",
- "count": 1
- }
- ]
- },
- {
- "property": "languages",
- "values": [
- {
- "val": "xoo",
- "count": 1
- }
- ]
- },
- {
- "property": "repositories",
- "values": [
- {
- "val": "squid-xoo",
- "count": 1
- }
- ]
- }
- ]
-}
+++ /dev/null
-{
- "rule": {
- "key": "squid:S0001",
- "repo": "squid",
- "name": "Deprecated rule",
- "createdAt": "2014-07-23T11:17:26+0200",
- "severity": "MINOR",
- "status": "DEPRECATED",
- "isTemplate": false,
- "tags": [
- "convention"
- ],
- "sysTags": [
- "pitfall"
- ],
- "lang": "java",
- "langName": "Java",
- "htmlDesc": "Deprecated rule",
- "mdDesc": "Deprecated rule",
- "defaultDebtChar": "TESTABILITY",
- "defaultDebtSubChar": "INTEGRATION_TESTABILITY",
- "debtChar": "TESTABILITY",
- "debtSubChar": "INTEGRATION_TESTABILITY",
- "debtCharName": "Testability",
- "debtSubCharName": "Integration level",
- "debtRemFnType": "LINEAR_OFFSET",
- "debtRemFnCoeff": "1h",
- "debtRemFnOffset": "30min",
- "defaultDebtRemFnType": "LINEAR_OFFSET",
- "defaultDebtRemFnCoeff": "1h",
- "defaultDebtRemFnOffset": "30min",
- "effortToFixDescription": "Effort to fix issue on one line",
- "debtOverloaded": false,
- "params": [ ]
- },
- "actives": [ ]
-}
+++ /dev/null
-{
-
- "rule": {
- "key": "squid-xoo:x1",
- "repo": "squid-xoo",
- "name": "No empty line",
- "createdAt": "2014-07-23T11:17:26+0200",
- "severity": "MINOR",
- "status": "BETA",
- "isTemplate": false,
- "tags": [ ],
- "sysTags": [
- "convention",
- "pitfall"
- ],
- "lang": "xoo",
- "langName": "Xoo",
- "htmlDesc": "Generate an issue on <em>empty</em> lines of Xoo source files",
- "mdDesc": "Generate an issue on *empty* lines of Xoo source files",
- "noteLogin": "admin",
- "mdNote": "As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!",
- "htmlNote": "As per the <a href=\"http://xoo.sonarsource.com/book\" target=\"_blank\">Book of Xoo</a>:<br/><blockquote>Xoo shall not pass!<br/></blockquote>",
- "defaultDebtChar": "TESTABILITY",
- "defaultDebtSubChar": "INTEGRATION_TESTABILITY",
- "debtChar": "TESTABILITY",
- "debtSubChar": "INTEGRATION_TESTABILITY",
- "debtCharName": "Testability",
- "debtSubCharName": "Integration level",
- "debtRemFnType": "LINEAR_OFFSET",
- "debtRemFnCoeff": "1h",
- "debtRemFnOffset": "30min",
- "defaultDebtRemFnType": "LINEAR_OFFSET",
- "defaultDebtRemFnCoeff": "1h",
- "defaultDebtRemFnOffset": "30min",
- "effortToFixDescription": "Effort to fix issue on one line",
- "debtOverloaded": false,
- "params": [
- {
- "key": "acceptWhitespace",
- "htmlDesc": "<h1>Accept whitespace (<code>\\s|\\t</code>) on the line\n</h1>This property is available so that a line containing only whitespace is not considered empty.<br/><h2>Example with property set to ``false``\n</h2><pre lang=\"xoo\"><code> <- One issue here\n<- And one here</code></pre><br/><br/><h2>Example with property set to ``true``\n</h2><pre lang=\"xoo\"><code> <- No issue here\n<- But one here</code></pre><br/>",
- "type": "BOOLEAN",
- "defaultValue": "false"
- },
- {
- "key": "textParameter",
- "htmlDesc": "This is a parameter of type TEXT",
- "type": "TEXT",
- "defaultValue": "false"
- },
- {
- "key": "skipLines",
- "htmlDesc": "Skip a number of lines at the beginning of the file",
- "type": "INTEGER",
- "defaultValue": "0"
- }
- ]
- },
- "actives": [
- {
- "qProfile": "xoo-sonar-way",
- "inherit": "NONE",
- "severity": "MAJOR",
- "params": [
- {
- "key": "acceptWhitespace",
- "value": "true"
- },
- {
- "key": "textParameter",
- "value": "A nice\ntext parameter\nwith newlines."
- },
- {
- "key": "skipLines",
- "value": "0"
- }
- ]
- }
- ]
-
-}
+++ /dev/null
-{
- "tags": [
- "error-handling",
- "misra-coffee",
- "multithreading",
- "performance",
- "pitfall",
- "bug",
- "convention",
- "security",
- "java8",
- "unused",
- "brain-overload"
- ]
-}
+++ /dev/null
-{
-
- "rule": {
- "key": "squid-xoo:x1",
- "repo": "squid-xoo",
- "name": "No empty line",
- "createdAt": "2014-07-23T11:17:26+0200",
- "severity": "MINOR",
- "status": "BETA",
- "isTemplate": false,
- "tags": [ ],
- "sysTags": [
- "convention",
- "pitfall"
- ],
- "lang": "xoo",
- "langName": "Xoo",
- "htmlDesc": "Generate an issue on <em>empty</em> lines of Xoo source files",
- "mdDesc": "Generate an issue on *empty* lines of Xoo source files",
- "noteLogin": "admin",
- "mdNote": "As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!",
- "htmlNote": "As per the <a href=\"http://xoo.sonarsource.com/book\" target=\"_blank\">Book of Xoo</a>:<br/><blockquote>Xoo shall not pass!<br/></blockquote>",
- "defaultDebtChar": "TESTABILITY",
- "defaultDebtSubChar": "INTEGRATION_TESTABILITY",
- "debtChar": "TESTABILITY",
- "debtSubChar": "INTEGRATION_TESTABILITY",
- "debtCharName": "Testability",
- "debtSubCharName": "Integration level",
- "debtRemFnType": "LINEAR_OFFSET",
- "debtRemFnCoeff": "1h",
- "debtRemFnOffset": "30min",
- "defaultDebtRemFnType": "LINEAR_OFFSET",
- "defaultDebtRemFnCoeff": "1h",
- "defaultDebtRemFnOffset": "30min",
- "effortToFixDescription": "Effort to fix issue on one line",
- "debtOverloaded": false,
- "params": [
- {
- "key": "acceptWhitespace",
- "htmlDesc": "<h1>Accept whitespace (<code>\\s|\\t</code>) on the line\n</h1>This property is available so that a line containing only whitespace is not considered empty.<br/><h2>Example with property set to ``false``\n</h2><pre lang=\"xoo\"><code> <- One issue here\n<- And one here</code></pre><br/><br/><h2>Example with property set to ``true``\n</h2><pre lang=\"xoo\"><code> <- No issue here\n<- But one here</code></pre><br/>",
- "type": "BOOLEAN",
- "defaultValue": "false"
- },
- {
- "key": "textParameter",
- "htmlDesc": "This is a parameter of type TEXT",
- "type": "TEXT",
- "defaultValue": "false"
- },
- {
- "key": "skipLines",
- "htmlDesc": "Skip a number of lines at the beginning of the file",
- "type": "INTEGER",
- "defaultValue": "0"
- }
- ]
- },
- "actives": [
- {
- "qProfile": "xoo-sonar-way",
- "inherit": "NONE",
- "severity": "MAJOR",
- "params": [
- {
- "key": "acceptWhitespace",
- "value": "false"
- },
- {
- "key": "textParameter",
- "value": "A nice\ntext parameter\nwith newlines.\nUpdated"
- },
- {
- "key": "skipLines",
- "value": "5"
- }
- ]
- }
- ]
-
-}
+++ /dev/null
-extends ./layouts/main
-
-block header
- script(src='../js/require.js')
- script.
- window.waitForMocks('/js/coding-rules-old/app.js');
-
-block body
- #content
- #coding-rules-page-loader.navigator-page-loader
- i.spinner
+++ /dev/null
-#
-# SonarQube, open source software quality management tool.
-# Copyright (C) 2008-2014 SonarSource
-# mailto:contact AT sonarsource DOT com
-#
-# SonarQube is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 3 of the License, or (at your option) any later version.
-#
-# SonarQube is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-class CodingRulesOldController < ApplicationController
-
- SECTION=Navigation::SECTION_CODING_RULES_OLD
-
- # GET /coding_rules_old/index
- def index
-
- end
-
-end
SECTION_QUALITY_PROFILES = Navigation.new('quality_profiles', false)
SECTION_QUALITY_GATES = Navigation.new('quality_gates', false)
SECTION_CODING_RULES = Navigation.new('coding_rules', false)
- SECTION_CODING_RULES_OLD = Navigation.new('coding_rules_old', false)
end
+++ /dev/null
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/js/coding-rules-old/app" src="<%= ApplicationController.root_context -%>/js/require.js"></script>
-<% end %>
-
-
-<div id="coding-rules-page-loader" class="navigator-page-loader">
- <i class="spinner"></i>
-</div>
<a href="<%= ApplicationController.root_context -%>/issues/index" class="<%= 'selected' if selected_section==Navigation::SECTION_ISSUES -%>"><%= message('issues.page') -%></a>
</li>
<li>
- <a href="<%= ApplicationController.root_context -%>/coding_rules" class="<%= 'selected' if selected_section==Navigation::SECTION_CODING_RULES -%>">NEW <%= message('coding_rules.page') -%></a>
- </li>
- <li>
- <a href="<%= ApplicationController.root_context -%>/coding_rules_old" class="<%= 'selected' if selected_section==Navigation::SECTION_CODING_RULES_OLD -%>"><%= message('coding_rules.page') -%></a>
+ <a href="<%= ApplicationController.root_context -%>/coding_rules" class="<%= 'selected' if selected_section==Navigation::SECTION_CODING_RULES -%>"><%= message('coding_rules.page') -%></a>
</li>
<li>
<a href="<%= ApplicationController.root_context -%>/profiles" class="<%= 'selected' if selected_section==Navigation::SECTION_QUALITY_PROFILES -%>"><%= message('quality_profiles.page') -%></a>