Difference between revisions of "GitHub Pull Requests"

From Lingoport Wiki
Jump to: navigation, search
(Created page with "= GitHub = is a Web-based Git repository hosting service. It offers all of the distributed revision control and source code management (SCM) functionality of Git as well as ad...")
 
(Example of a Pull Request Analyzed with Globalyzer)
Line 10: Line 10:
 
== Example of a Pull Request Analyzed with Globalyzer ==
 
== Example of a Pull Request Analyzed with Globalyzer ==
   
  +
[[File:GlobalyzerGitHubPullRequest.png]]
   
  +
This is pull request <b>#6</b>. The change to the code in the pull request was to add an embedded string to the file <code>testpull.java</code>, namely <code>String anotherunused = "In the bed string";</code>.
  +
  +
Globalyzer analysis flagged this line as a active Embedded String.
  +
  +
Before merging the code back to master, the developer would typically externalize the string and re-submit the changed code and resource file.
   
 
== Pull Request Analysis Configuration ==
 
== Pull Request Analysis Configuration ==

Revision as of 19:06, 19 November 2015

GitHub

is a Web-based Git repository hosting service. It offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features.

Git Pull Requests

Files can be committed in a Git branch or directly in Master. When committing files in a branch, pull requests let you tell others about changes you've pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary.

Dashboard and Pull Requests

Globalyzer Dashboard is based on SonarQube and leverages that platform's feature. Starting with Lingoport Dashboard 5.1.2, the GitHub Plugin is available. It allows to show Dashboard issues within GitHub as comments of the pull request.

Example of a Pull Request Analyzed with Globalyzer

GlobalyzerGitHubPullRequest.png

This is pull request #6. The change to the code in the pull request was to add an embedded string to the file testpull.java, namely String anotherunused = "In the bed string";.

Globalyzer analysis flagged this line as a active Embedded String.

Before merging the code back to master, the developer would typically externalize the string and re-submit the changed code and resource file.

Pull Request Analysis Configuration

Globalyzer Dashboard uses SonarQube sonar-project.properties. For the i18n analysis of the pull request, the sonar-project.properties needs the following properties:

  • sonar.analysis.mode=issues
  • sonar.github.login=
  • sonar.github.oauth=
  • sonar.github.repository=
  • sonar.github.pullRequest=

For instance, here is a test sonar-project.properties with some properties modified for security reasons:

sonar.projectKey=Lingoport.indexing2:scan
sonar.projectName=Lingoport.indexing2
sonar.projectVersion=1.0
sonar.sources=C:/Users/Joe/Documents/GitHub/indexing2
sonar.importSources=true
sonar.lingoport.project.root=.
sonar.language=lport
sonar.lingoport.extensions=as,mxml,asp,asax,ascx,ashx,aspx,awk,c,c++,cc,cpp,cxx,h,hpp,hxx,sqc,sqx,qml,cs,dfm,dpk,dpr,pas,java,jsp,jspf,js,perl,pl,pm,plx,inc,php,sql,sqc,sqx,bas,cls,ctl,dob,dsr,frm,pag,vb,vbs,htm,html,shtml,vm,html5,xml,xsd,xsl,xslt,wsdl,wsdd,rmd,tld,xliff,xul,xhtml,mxml,jspx,xaml,css,cat,resx,msg,po,properties,rc,rc2,strings,json,ts,rxml,rjs,properties 

#
# For the GitHub SonarQube Plugin
#
sonar.analysis.mode=issues
sonar.github.login=ursulaLingoport
sonar.github.oauth=d60bbe9d6d3c7caa995f5119ff2997b26d0ef191
sonar.github.repository=ursulaLingoport/indexing2
sonar.github.pullRequest=6

Running the Analysis

  • Checkout/pull the code from a branch (not master)
  • Modify the code
  • Commit & push the code to the branch (not master)
  • Create a pull request
  • Run a couple of commands:
    • java -jar "c:\lingoport\globalyzer-lite-4.8.5\globalyzer-lite.jar" GzProjectDefinition.xml
    • C:\sonar\sonar-runner-2.4-local\bin\sonar-runner
  • Check the pull request comments on GitHub: The i18n issues found on the code in the pull request will be shown.

Note: The command java -jar "c:\lingoport\globalyzer-lite-4.8.5\globalyzer-lite.jar" GzProjectDefinition.xml is used to create a Globalyzer report under the directory GlobalyzerScans. It could be any commands to create that Globalyzer report. The sonar-runner then needs to be executed from above the GlobalyzerScans directory.