I am following this article to integrate SonarQube with Xcode and analyse Objective-C code. Though the setup is functional and getting no error/warnings after running the shell script, no violations are shown in the Dashboard. All i get to see is basic metrics like no. of lines of code, no. of files, etc.
Is there anyone who has tried this and guide me further.
In addition to the article you have specified above, I have few additions to that. You can follow the steps below,
Prerequisites:
Sonar
Sonar-runner
SonarQube Objective-C plugin (Licensed)
XCTool
OCLint (violations) and gcovr (code coverage)
MySql and JDK
Installation Steps:
Download and install MySql dmg. And then start the MySQL server from the System Preferences or via the command line or if restarted it has to be command line.
To start - sudo /usr/local/mysql/support-files/mysql.server start
To restart - sudo /usr/local/mysql/support-files/mysql.server restart
To stop - sudo /usr/local/mysql/support-files/mysql.server stop
Download and install latest JDK version.
Go to the terminal and enter the following commands to install the
prerequisites. (Homebrew is the package
management system for Mac Operating System. to install homebrew, enter the command -
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)")
Sonar - brew install sonar
Sonar-runner - brew install sonar-runner
XCTool - brew install xctool
OCLint - brew install oclint or
brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb for version 0.8.1(updated))
gcovr - brew install gcovr
Configuration:
- Set environment path of the Sonar:
export SONAR_HOME=/usr/local/Cellar/sonar-runner/2.4/libexec
export SONAR=$SONAR_HOME/bin
export PATH=$SONAR:$PATH
finally the command echo $SONAR_HOME should return the path - /usr/local/Cellar/sonar-runner/2.4/libexec
- Set up MySql DB:
export PATH=${PATH}:/usr/local/mysql/bin
mysql -u root;
CREATE DATABASE sonar_firstdb;
CREATE USER 'sonar'#'localhost' IDENTIFIED BY 'sonar';
GRANT ALL PRIVILEGES ON sonar_firstdb.* TO 'sonar'#'localhost';
FLUSH PRIVILEGES;
exit
- Set Sonar configuration settings:
vi /usr/local/Cellar/sonar/5.1.2/libexec/conf/sonar.properties
You can comment out most options except credentials and mysql and make sure that you enter the correct database name.
eg:
sonar.jdbc.url=jdbc:mysql://localhost:3306/**sonar_firstdb**?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
.
vi /usr/local/Cellar/sonar-runner/2.4/libexec/conf/sonar-runner.properties
You can comment out most options except credentials and mysql and make sure that you enter the correct database name.
eg:
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar_firstdb?useUnicode=true&characterEncoding=utf8
Start sonar using the command -
sonar start
The command will launch sonar so navigate to http://localhost:9000 in your browser of choice. Login (admin/admin) and have a look around.
Now you have to install the Objective-C or Swift plugin.
Move to Settings -> System -> Update Center -> Available Plugins (install the required plugin).
You have to restart the sonar to complete the installation once the pligin is added, And add license key once the plugin is installed.
through terminal go to the root directory of a project you want sonar to inspect, and create a project specific properties file with the following command:
vi sonar-project.properties
Add the following project specific properties and edit the bolded sections as per your project.
// Required configuration
sonar.projectKey=**com.payoda.wordsudoku**
sonar.projectName=**DragDrop**
sonar.projectVersion=**1.0**
sonar.language=**objc**
// Project description
sonar.projectDescription=**Sample description**
// Path to source directories
sonar.sources=**~/path to your project**
// Path to test directories (comment if no test)
//sonar.tests=testSrcDir
// Xcode project configuration (.xcodeproj or .xcworkspace)
// -> If you have a project: configure only sonar.objectivec.project
// -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project
// and use the later to specify which project(s) to include in the analysis (comma separated list)
sonar.objectivec.project=**DragDrop.xcodeproj**
// sonar.objectivec.workspace=myApplication.xcworkspace
// Scheme to build your application
sonar.objectivec.appScheme=**DragDrop**
// Scheme to build and run your tests (comment following line of you don't have any tests)
//sonar.objectivec.testScheme=myApplicationTests
/////////////////////////
// Optional configuration
// Encoding of the source code
sonar.sourceEncoding=**UTF-8**
// JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml
// Change it only if you generate the file on your own
// Change it only if you generate the file on your own
// The XML files have to be prefixed by TEST- otherwise they are not processed
// sonar.junit.reportsPath=sonar-reports/
// Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
// Change it only if you generate the file on your own
// sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml
// OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
// Change it only if you generate the file on your own
// sonar.objectivec.oclint.report=sonar-reports/oclint.xml
// Paths to exclude from coverage report (tests, 3rd party libraries etc.)
// sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2
sonar.objectivec.excludedPathsFromCoverage=.*Tests.*
// Project SCM settings
// sonar.scm.enabled=true
// sonar.scm.url=scm:git:https://...
Save the file and you can reuse the same for other projects.
In the project root directory run the command - sonar-runner
You should try it with an older version of SonarQube (< 4.0 usually works).
Related
How to configure Azure function project in Intellij/Pycharm run/debug configurations on Mac because I've tried to set it by my own but it doesnt work.
I would like to replace shell command: func start with run config
The image below from Pycharm
UPDATE
I've added path to Azure-CLI and imported my app-settings
I'm trying to configure the run configs but it asks to select the module but there is no any module in dropdown (see pic)
UPDATE-UPDATE:
Here is what azure-tools-for-intellij team me answered:
They dont support pure python functions run yet
I think you shouldn't use row shell scrip with IntelliJ/PyCharm instead of this you should use Azure Toolkit for IntelliJ and run/debug your functions like in this guide.
Also when you install Azure Toolkit for IntelliJ you will have the opportunity to create run/debug configuration with predefined Azure Function ready template.
Just example:
I found the way to debug in Intellij Idea/PyCharm.
add these lines at the top of your file/module:
import pydevd_pycharm
pydevd_pycharm.settrace('127.0.0.1', port=9091, stdoutToServer=True, stderrToServer=True)
set Python Debug Server with host and port in Run/Debug Configs
run your azure functions as used to (func host start) and press debugging button.
The way I do it in PyCharm is to define a shell script configuration (Edit Configurations > Shell Script) and set:
Execute: Script set
Script text: func start
Working directory: should be to project directory where host.json etc. is located
Environment variables: leave empty
Execute in the terminal: checked
Run this configuration, which will start the test server in terminal. Then go to Run > Attach to Process... and select the process (usually it's the one without any path after the number).
I have just installed the Sigasi Studio pluginin Eclipse (version: Eclipse IDE 2018-12). When I try to launch it,to make a new VHDL file, I get the following:
The selected wizard could not be started. org/eclipse/lsp4j/Range
(occurred in com.sigasi.hdt.vhdl.ui.VhdlExecutableExtensionFactory)
org/eclipse/lsp4j/Range
How I could solve it, please?
Thank you in advance.
Thanks to the Sigasi support, I was able to solve the problem. They wrote me:
The lsp4j plugin version is to recent for the xtext version that ships
with Sigasi Studio 4.2. This issue has been resolved in the preview
channel of release 4.3. Therefore - if you wish to use the plugin
version of Sigasi Studio - I recommend to install the 4.3 preview
following the steps explained on
http://insights.sigasi.com/tech/preview.html.
That's all. Now, I would like to configure Sigasi with GHDL (as a compiler, when I run the project) and GTKWAVE (ad a waves viewer). How can I do that?
Thanks in advance.
SIGASI + GHDL + GTKWAVE (all in one)
It is very powerful combo that you can set up. ATTENTION i use macOS 10.13.6:
Step 1
Make sure you have both installed GHDL and GTKWAVE typing
$ which gtkwave
/usr/local/bin/gtkwave
$ which ghdl
/usr/local/bin/ghdl
Step 2
Open Sigasi an make new Project and create an additional compile.sh file with:
#!/bin/sh
PROJECT_NAME="PWM_Generator"
PROJECT_NAME_TB="PWM_Generator_tb"
WORKING_DIR="/Users/imeksbank/Dropbox/UMHDL"
/usr/local/bin/ghdl -a --workdir=$WORKING_DIR/work.ghdl $WORKING_DIR/$PROJECT_NAME/$PROJECT_NAME.vhd;
/usr/local/bin/ghdl -a --workdir=$WORKING_DIR/work.ghdl $WORKING_DIR/$PROJECT_NAME/$PROJECT_NAME_TB.vhd;
/usr/local/bin/ghdl -e --workdir=$WORKING_DIR/work.ghdl $PROJECT_NAME_TB;
/usr/local/bin/ghdl -r --workdir=$WORKING_DIR/work.ghdl $PROJECT_NAME_TB --vcd=$WORKING_DIR/$PROJECT_NAME/simulation.vcd;
now, be aware, for each project you create your own variables like
PROJECT_NAME
PROJECT_NAME_TB
WORKING_DIR
I use always Dropbox for such approach because then i can access via Windows as well.
And of course, there is a possibility to create custom variables in Sigasi -> External Tool Configurator -> Program -> compile_sh -> environment to pass them to make compile.sh independent. Here you have to deal with it by yourself =)
Step 3 .
Set up you External Tools Configurations to let shell script be executed by Sigasi Studio and create the .vcd file for gtkwave:
Click on currently created Project (in my case it is the PWM_Generator).
After that click on Run -> External Tools -> External Tools Configurations ....
Then go to the left sidebar and under Program create your own anchor like compile_sh.
Finally you have your route :
Program
--compile_sh
And now extend this anchor by a custom created shell script :
Main->Location gets ${workspace_loc:/PWM_Generator/compile.sh}
Main->Working Directory gets ${workspace_loc:/PWM_Generator}
Click Apply and Run and that's it !!! After this you can program VHDL / Verilog and compile via Run -> External Tools -> compile_sh having created .vcd. In your project appears the gtkwave file and there just double click and it starts. =)
Googles documentation on installing the library, found here: https://github.com/googleads/googleads-php-lib/blob/master/README.md#getting-started, instructs us to copy adsapi_php.ini, as constructed here: https://github.com/googleads/googleads-php-lib/blob/master/examples/AdWords/adsapi_php.ini, to your home directory.
I filled out the necessary variables in the .ini, and I am using docker so I have placed this file inside my container at /var/www/home/node/ and when I run the command composer require googleads/googleads-php-lib I am given the following error in the command prompt:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for googleads/googleads-php-lib ^37.1 -> satisfiable by googleads/googleads-php-lib[37.1.0].
- googleads/googleads-php-lib 37.1.0 requires ext-soap * -> the requested PHP extension soap is missing from your system.
To enable extensions, verify that they are enabled in your .ini files:
- /usr/local/etc/php/php.ini
- /usr/local/etc/php/conf.d/adsapi_php.ini
- /usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini
- /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini
- /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I assumed the issue was my adsapi_php.ini was simply in the wrong location as it contains what I believe is necessary to avoid the above issue, but I have tried placing it in several different places and yet I always get the same error.
Any help would be appreciated!
Just try to edit php.ini inside docker (docker exec -t {container} bashand enable there the extenstion soap
I'm currently setting up a Kaltura streaming server on CentOS 7 with mariaDB. When I come to the point the installation manual requires me to install oflaDemo via browser, I only get an empty list. No connection errors occour. The debug output states:
Host: vstream-dev.my.domain
Trying to connect
Net status: NetConnection.Connect.Success
Got the application list
Got the application list
Got the application list
So, in theory there shouldn't be a problem.
Firewall is down for testing/devel
SELinux is off (permissive)
The only error that ocoured during the installation process was packet mysql-server is not installed. But the manual states that I should use mariaDB on CentOS 7.
I tried to clone https://github.com/Red5/red5-examples and link the ofla Demo folder to /usr/lib/red5/webapps/ with no success.
Ok, I solved it.
What I did:
I cloned the repo with the red5 examples: https://github.com/Red5/red5-examples and navigated into the subfolder oflaDemo (with pom.xml).
Then I had to install maven with
yum install -y maven
and do a maven build
mvn clean install
After that, I was able to grab the file target/red5-example-oflaDemo-2.0.war. I extracted this file into a folder oflaDemo in /var/lib/red5/webapps and restarted the server. Finally, I did mkdir /usr/lib/red5/webapps/oflaDemo/streams to create a folder for the streams.
After that, I was able to navigate to the demo via
http://my.domain:5080/oflaDemo/
I have downloaded solr from :
http://svn.apache.org/repos/asf/lucene/dev/trunk/
and when i try to start solr by :
/solr/example/java -jar start.jar &
and try to open in browser at 8983 port it is not opening saying ?
HTTP ERROR: 404
Problem accessing /solr/admin/schema.jsp. Reason:
NOT_FOUND
Powered by Jetty://
how to start by developer trunk actually want to use solr 4.0
If you have downloaded the source code from trunk, it does not come bundled with the solr.war.
Can execute ant command from the base directory OR
Build the artifacts for solr by executing ant dist from the solr folder
Once the artifacts is built, you will find a dist folder with the apache-solr-xx.war
You would need to copy the war (and rename to solr.war) into the /solr/example/webapps/ for solr to be available.
This should get you started.
Example steps -
1. svn checkout http://svn.apache.org/repos/asf/lucene/dev/trunk/ solr_trunk
2. cd solr_trunk
3. ant or ant dist (from solr folder)
4. Copy the war file (and rename to solr.war) from solr/dist folder to /solr/example/webapps/
5. /solr/example/java -jar start.jar
See the README.txt:
To compile the sources run 'ant compile'
This will compile you the solr.war.