Skip to content

Instantly share code, notes, and snippets.

@bartfastiel
Last active June 13, 2020 16:39
Show Gist options
  • Save bartfastiel/0eabdb57c144434bd74958b092a26ec2 to your computer and use it in GitHub Desktop.
Save bartfastiel/0eabdb57c144434bd74958b092a26ec2 to your computer and use it in GitHub Desktop.
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/enable_support" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/create?name=myorg&key=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/create?name=myprofile&language=java&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search?organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search?defaults=true" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=myproject&name=myproject" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/search?project=myproject" | python -m json.tool
#delete
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/create?name=crapprofile&language=java&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/qualityprofiles/delete?name=crapprofile&language=java&organization=myorg" | python -m json.tool
curl -XPUT 'http://localhost:9010/issues/_settings' -d '{
"index": {
"blocks": {
"read_only": true
}
}
}'
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/enable_support"
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/create?name=myorg&key=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=b&name=b&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/users/create?login=anton&name=anton&password=anton" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/add_member?login=anton&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/permissions/add_user?project=b&login=anton&permission=admin"
#/bin/sh
# project permissions: admin, codeviewer, issueadmin, scan, user
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/enable_support"
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/create?name=myorg&key=myorg" | python -m json.tool
cd /tmp
cd $(mktemp -d)
pwd
# project a has no specific setup
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=a&name=a&organization=myorg" | python -m json.tool
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=a -Dsonar.sources=. -Dsonar.organization=myorg -Dsonar.login=admin -Dsonar.password=admin
rm *.java
# project b has one user with admin permission
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=b&name=b&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/users/create?login=anton&name=anton&password=anton" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/add_member?login=anton&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/permissions/add_user?projectKey=b&login=anton&permission=admin" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/permissions/remove_group?projectKey=b&groupName=anyone&permission=user&organization=myorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/permissions/remove_group?projectKey=b&groupName=anyone&permission=codeviewer&organization=myorg" | python -m json.tool
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=b -Dsonar.sources=. -Dsonar.organization=myorg -Dsonar.login=admin -Dsonar.password=admin
rm *.java
#/bin/sh
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/enable_support"
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/create?name=mypublicorg&key=mypublicorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=myprojectimplicitpublic&name=myprojectimplicitpublic&organization=mypublicorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=myprojectexplicitprivate&name=myprojectexplicitprivate&organization=mypublicorg&visibility=private" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=myprojectexplicitpublic&name=myprojectexplicitpublic&organization=mypublicorg&visibility=public" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/create?name=myprivateorg&key=myprivateorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/organizations/update_project_visibility?organization=myprivateorg&projectVisibility=private"
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/create?project=myprojectimplicitprivate&name=myprojectimplicitprivate&organization=myprivateorg" | python -m json.tool
curl -s -u admin:admin -XPOST "localhost:9000/api/projects/update_visibility?project=myprojectexplicitprivate&visibility=private" | python -m json.tool
cd /tmp
cd $(mktemp -d)
pwd
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=myprojectimplicitpublic -Dsonar.sources=. -Dsonar.organization=mypublicorg -Dsonar.login=admin -Dsonar.password=admin
rm *.java
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=myprojectexplicitprivate -Dsonar.sources=. -Dsonar.organization=mypublicorg -Dsonar.login=admin -Dsonar.password=admin
rm *.java
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=myprojectexplicitpublic -Dsonar.sources=. -Dsonar.organization=mypublicorg -Dsonar.login=admin -Dsonar.password=admin
rm *.java
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=myprojectimplicitprivate -Dsonar.sources=. -Dsonar.organization=myprivateorg -Dsonar.login=admin -Dsonar.password=admin
rm *.java
cd /tmp
cd $(mktemp -d)
pwd
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.projectVersion=1
echo "public class MyClass1 {" > MyClass1.java
echo " public static void main(String[] args) {" >> MyClass1.java
echo " System.out.println(1);" >> MyClass1.java
echo " }" >> MyClass1.java
echo "}" >> MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.projectVersion=2
echo "public class MyClass1 {" > MyClass1.java
echo " public static void main(String[] args) {" >> MyClass1.java
echo " " >> MyClass1.java
echo " int target = -5;" >> MyClass1.java
echo " int num = 3;" >> MyClass1.java
echo " " >> MyClass1.java
echo " target =- num; // Noncompliant; target = -3. Is that really what's meant?" >> MyClass1.java
echo " target =+ num; // Noncompliant; target = 3" >> MyClass1.java
echo " " >> MyClass1.java
echo " }" >> MyClass1.java
echo "}" >> MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.projectVersion=2
cd /tmp
cd $(mktemp -d)
pwd
echo "public class MyClass1 {}" > MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.projectVersion=1
echo "public class MyClass1 {" > MyClass1.java
echo " public static void main(String[] args) {" >> MyClass1.java
echo " " >> MyClass1.java
echo " int target = -5;" >> MyClass1.java
echo " int num = 3;" >> MyClass1.java
echo " " >> MyClass1.java
echo " target =- num; // Noncompliant; target = -3. Is that really what's meant?" >> MyClass1.java
echo " target =+ num; // Noncompliant; target = 3" >> MyClass1.java
echo " " >> MyClass1.java
echo " }" >> MyClass1.java
echo "}" >> MyClass1.java
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.projectVersion=2
curl -s -u admin:admin -XPOST "localhost:9000/api/views/run"
cd /tmp
cd $(mktemp -d)
pwd
git init
echo "public class MyClass1 {" > MyClass1.java
echo "}" >> MyClass1.java
git add .
git commit --all --message="Initial commit"
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.version=1
echo "public class MyClass1 {" > MyClass1.java
echo "public static void main(String[] args) {" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "System.out.println(1);" >> MyClass1.java
echo "}" >> MyClass1.java
echo "}" >> MyClass1.java
git commit --all --message="19 New Lines"
~/SonarSource/sonar-scanner-2.8/bin/sonar-scanner -Dsonar.projectKey=my_project -Dsonar.sources=. -Dsonar.login=admin -Dsonar.password=admin -Dsonar.version=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment