Not able to scan file locate at root folder using sonar scanner - drupal-7

I am using sonarqube and sonarqube scannner for my Drupal project. As drupal project is multi-module project and has many custom modules developed under custom_module folder.
I am scanning only custom folders listed under folder custom_module.
Suppose there are 3 custom modules I want to scan...
custom_module1, custom_module2, custom_module3 and sub-folders inc,modules and templates under them...
My sonar-project.properties file looks like
# Root project information
sonar.projectKey=MyProjectKey
sonar.projectName=My Project
sonar.projectVersion=1.0
# Some properties that will be inherited by the modules
sonar.sources=inc,modules,templates
sonar.php.file.suffixes=php,module,inc
# List of the module identifiers
sonar.modules=custom_module1,custom_module2,custom_module3
# Properties can obviously be overriden for
# each module - just prefix them with the module ID
custom_module1.sonar.projectName=custom_module1
custom_module2.sonar.projectName=custom_module2
custom_module3.sonar.projectName=custom_module3
Now everything is working fine and it is scanning all files except .module file at root of each module. e.g. custom_module1/custom_module1.module
What should I add in properties file so that it includes .module file?

you can add folders to scan with sonar.sources
if you would like to scan all the files sonar.sources=.
I think the way you can do that is add the dot to scan all of files/folders and add a new line for exlusions sonar.exclusions= so it is going to skip the folder/files you which are after the exlusions.

I got the solution for above problem. By adding separate 'sources' for each module will resolve the issue.
So updated sonar-project.properties file :-
# Root project information
sonar.projectKey=MyProjectKey
sonar.projectName=My Project
sonar.projectVersion=1.0
# Some properties that will be inherited by the modules
sonar.php.file.suffixes=php,module,inc
# List of the module identifiers
sonar.modules=custom_module1,custom_module2,custom_module3
# Properties can obviously be overriden for
# each module - just prefix them with the module ID
custom_module1.sonar.projectName=Custom Module1
custom_module2.sonar.projectName=Custom Module2
custom_module3.sonar.projectName=Custom Module3
custom_module1.sonar.sources=inc,modules,templates,custom_module1.module
custom_module2.sonar.sources=inc,modules,templates,custom_module2.module
custom_module3.sonar.sources=inc,modules,templates,custom_module3.module
Using this one can add files at root folder.

Related

For sencha app build , do we need to include all js files related to view in main.js(portal.js)?

I am using sencha cmd 6 for building my application.
my folder structure is
classic
src
model
view
account
jobs
portal
portal.js
controller
store
production build process execution is successful but when i load that build its giving .js file not found error.
So i include all js files in folder structure into main js portal.js then .js error is removed and build works.
But i dont want to include all these list of files in one single js, so can we skip the js include part from portal.js and use any property or attribute to include all js files ?
You can specify with * like 'Ext.chart.*' in requires section of Ext.app.Application.
Hope this helps.

Artifact directory for rendering template in custom Grails 3 script

In the Grails 3.2.3 documentation, it shows this piece of code as an example of a custom script:
def scriptName = args[0]
def model = model(scriptName)
def overwrite = flag('force') ? true : false
render template: template('artifacts/Script.groovy'),
destination: file("src/main/scripts/${model.lowerCaseName}.groovy"),
model: model,
overwrite: overwrite
Where is the artifacts directory in the grails-app or src hierarchies?
For the example you cite, the artifacts directory is in the profile's jar file.
(the relevant source is: https://github.com/grails-profiles/base/tree/master/templates)
In general any profile or plugin that has a templates directory, it will be found in the jar for the profile or the plugin.
But your project can override anything from a profile or a plugin. You follow the same pattern for the different kinds of templates rooted in your project at src/main/templates.
For example, if you say
grails install-templates
A directory src/main/templates/scaffolding will be created containing copies of the templates applied by the scaffolding plugin that you can edit to customize how scaffolding views, generated controllers and so on, render.
For script templates, the path is artifacts not scaffolding, so if you have a script template or a domain class template you like better than the default one, you would put it in
src/main/templates/artifacts

Recommended location for Domain Model classes

I am learning Angular 2 and I am using angular-cli to generate components and services. I am using the directory structure proposed by angular-cli (see screenshot below). I need to add some domain model object (e.g. User, Profile, etc.), but I don't know where to put them.
What is the recommended location for those objects in the directory structure?
You will want to have your app-wide models stored at the root level (default: src/app) except that those values should be in the shared directory (src/app/shared).
If you generate those models with the CLI (from the project root directory) you will run:
ng generate class shared/profile model
which will yield:
src/app/shared/profile.model.ts
src/app/shared/profile.model.spec.ts
and also add a reference to the profile exports to the index.ts within the shared directory, so you can reference them (from the root component)
import { Profile } from './shared';
If the domain model classes are used by all the components, it can be put in a model.ts file within shared folder.

Go Package Conflict

I am new to Go and AppEngine. I am trying to figure out how to create packages but I keep running into conflicts. My directory structure is below:
GOPATH
third-party-libs
app
app.yaml
controllers
default.go -- package controllers
models
models.go -- package models
templates
templates.go -- package templates
I am importing the templates package as follows import ("app/templates") inside default.go
When I do goapp serve I get this error:
Failed parsing input: app file templates.go conflicts with
same file imported from GOPATH
I have tried a bunch of things and nothing has worked so far. These are things I have tried:
Changed the templates directory to apptemplates and the corresponding file to apptemplates.go, changed package name to apptemplates. I imported it as app/apptemplates
I tried different combinations by changing the file name but not the package name, vice versa, etc. Either it does not find the file or has a conflict.
I am importing html/template in my templates.go file. So I commented out the entire file just keeping the package declaration but did not make the conflict go away
I thought may be another file is named templates.go but when I do this (at the GOPATH level) find . -name "*.go" | grep "templates.go" I only see the one file I have created.
I am confused as to how packages are created. I have changed the name to something generic so it does not look like a naming issue. Can someone please tell me how I can debug this error?
Thanks!
Rename the package to a non-conflicting name as in #1. Import the package using the path "apptemplates".
Packages inside of the application directory (the directory containing app.yaml) are imported with a path relative to the application directory. See Organizing Go Apps for the complete details.

Configure Compass within a CakePHP project

I've been looking into Compass and the more I look, the more it feels like the way that CSS should be written. As a test case, I'd like to use it in one of my CakePHP projects. Unfortunately, I'm having some trouble with the initial configuration. Specifically, with getting the resources in the right place and referenced properly in the compiled CSS.
I'm creating a :stand_alone project in my /app directory. Well, that's what I want to do. Compass doesn't seem to like that. In creating the project, I've told it where to put the css, images and js and those resources do, in fact, make it to the proper directory. Unfortunately, because I'm not creating the directory in the webroot, the resources are being referenced incorrectly when compiled.
I'm creating the Compass project in my CakePHP app/ directory with this command:
$ compass -f blueprint --sass-dir sass --css-dir webroot/css/ --images-dir webroot/img/ --javascripts-dir webroot/js/ --output-style compact .
The compiled CSS, though, wants to reference Blueprint's showgrid.png image as:
url('/webroot/img/grid.png?1264969358')
I suppose this is a pretty predictable result, but I can't figure out how to get the compiled CSS to reference the correct /img/grid.png?whatever path. Is that even possible? Am I forced to create my Compass project directly in my webroot?
Thanks.
UPDATE
Content of my config.rb file:
# Require any additional compass plugins here.
project_type = :stand_alone
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "webroot/css"
sass_dir = "sass"
images_dir = "webroot/img"
http_images_path = "/img"
javascripts_dir = "webroot/js"
output_style = :compact
Running Compass v0.10 and using the following configuration:
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
sass_dir = "sass"
css_dir = "webroot/css"
images_dir = "webroot/images"
javascripts_dir = "webroot/js"
http_stylesheets_dir = "css"
http_javascripts_dir = 'js'
http_images_dir = 'images'
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
provides the expected results.
Compass v0.10 is just about to be release, you can install it with:
(sudo) gem install compass --pre
To create a project using this config:
Create a project directory
Save the config into config.rb in the project directory.
From within your project directory run the command: compass install blueprint
Rails and other frameworks have the sass files and configuration in the project root, outside the public webroot. A stand-alone project should work fine this way too.
Are you using image_url() for when you're referencing an image?
In your compass.config file you can set the http_images_path if it's different from your directory path. See the configuration page in the wiki for more details.

Resources