Skip to content

Commit

Permalink
added qulice and fixed part of its reports
Browse files Browse the repository at this point in the history
  • Loading branch information
yasamprom committed Jul 4, 2022
1 parent 8e22186 commit 23bd13a
Show file tree
Hide file tree
Showing 24 changed files with 927 additions and 853 deletions.
29 changes: 25 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ buildscript {
}
}
dependencies {
// qulice doesn't generate gradle task
// classpath "gradle.plugin.com.github.sherter.google-java-format:google-java-format-gradle-plugin:0.9"
}
}


plugins {
id "org.jetbrains.intellij" version "1.5.3"
// id "com.github.dkorotych.gradle-maven-exec" version "2.2.1"
}

java {
Expand All @@ -26,6 +25,7 @@ wrapper {
doLast {
println "WRAPPER"
}
// gradleVersion = '6.3.0'
gradleVersion = '7.4.2'
}

Expand All @@ -38,6 +38,7 @@ apply plugin: 'antlr'
apply plugin: 'jacoco'



task getGrammar {
doFirst {
def f = new File('src/main/antlr/org/jetbrains/eolang/parser/EO.g4')
Expand Down Expand Up @@ -65,6 +66,12 @@ task getGrammar {
}
}

tasks.register('hello') {
doLast {
ant.echo('hello from Ant')
}
}

jacoco {
toolVersion = "0.8.7"
}
Expand All @@ -75,11 +82,25 @@ jacocoTestReport {
html.required = false
xml.required = true
csv.required = false
// xml.outputLocation = layout.buildDirectory.dir('jacoco')
xml.destination file("${buildDir}/reports/jacoco/report.xml")
}
}

task qulice (type: Exec) {
commandLine 'mvn', 'clean install -Pqulice --errors -Dstyle.color=never'
}
/*task qulice(type: MavenExec) {
goals 'check'
options {
license = file("LICENSE.txt")
define = [
'groupId' : 'com.qulice',
'artifactId': 'qulice-maven-plugin'
]
}
}*/


compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down Expand Up @@ -120,7 +141,7 @@ dependencies {
exclude group:'com.ibm.icu', module:'icu4j'
}
implementation 'org.antlr:antlr4-intellij-adaptor:0.1'
// implementation "com.qulice:qulice-gradle-plugin:0.18.19"
// implementation "com.qulice:qulice-maven-plugin"
testImplementation group: 'junit', name: 'junit', version: '4.11'
}

Expand Down
44 changes: 44 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eolang</groupId>
<artifactId>org.eolang.jetbrains</artifactId>
<version>1</version>
<dependencies>

</dependencies>
<profiles>
<profile>
<id>qulice</id>
<build>
<plugins>
<plugin>
<groupId>com.qulice</groupId>
<artifactId>qulice-maven-plugin</artifactId>
<configuration>
<excludes combine.children="append">
<exclude>checkstyle:/src/site/resources/.*</exclude>
<exclude>duplicatefinder:.*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

</project>
148 changes: 89 additions & 59 deletions src/main/java/org/eolang/jetbrains/EOColorSettingsPage.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2021-2022 Stepan Strunkov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.eolang.jetbrains;

import com.intellij.openapi.editor.colors.TextAttributesKey;
Expand All @@ -10,71 +34,77 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Class drawing settings page in IDE
* @see <a href="https://plugins.jetbrains.com/docs/intellij/syntax-highlighter-and-color-settings-page.html">
* documentation</a>
*/

public class EOColorSettingsPage implements ColorSettingsPage {
private static final AttributesDescriptor[] DESCRIPTORS =
new AttributesDescriptor[] {
new AttributesDescriptor("Keywords", EOSyntaxHighlighter.KEYWORD),
new AttributesDescriptor("Comments", EOSyntaxHighlighter.COMMENT),
new AttributesDescriptor("Identifiers", EOSyntaxHighlighter.NAME),
new AttributesDescriptor("Strings", EOSyntaxHighlighter.STRING),
new AttributesDescriptor("Metas", EOSyntaxHighlighter.META),
new AttributesDescriptor("Constants", EOSyntaxHighlighter.NUMBERS),
new AttributesDescriptor("Braces", EOSyntaxHighlighter.BRACES)
};
private static final AttributesDescriptor[] DESCRIPTORS =
new AttributesDescriptor[] {
new AttributesDescriptor("Keywords", EOSyntaxHighlighter.KEYWORD),
new AttributesDescriptor("Comments", EOSyntaxHighlighter.COMMENT),
new AttributesDescriptor("Identifiers", EOSyntaxHighlighter.NAME),
new AttributesDescriptor("Strings", EOSyntaxHighlighter.STRING),
new AttributesDescriptor("Metas", EOSyntaxHighlighter.META),
new AttributesDescriptor("Constants", EOSyntaxHighlighter.NUMBERS),
new AttributesDescriptor("Braces", EOSyntaxHighlighter.BRACES)
};

@Nullable
@Override
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
return null;
}
@Nullable
@Override
public Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap() {
return null;
}

@Nullable
@Override
public Icon getIcon() {
return Icons.EO_ICON;
}
@Nullable
@Override
public Icon getIcon() {
return Icons.EO_ICON;
}

@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
return new EOSyntaxHighlighter();
}
@NotNull
@Override
public SyntaxHighlighter getHighlighter() {
return new EOSyntaxHighlighter();
}

@NotNull
@Override
public String getDemoText() {
return "+alias org.eolang.io.stdout\n" +
"+alias org.eolang.txt.sprintf\n\n" +
"# is year leap?\n\n" +
"[args...] > main\n" +
" [y] > leap\n" +
" or. > @\n" +
" and.\n" +
" eq. (mod. y 4) 0\n" +
" not. (eq. (mod. y 100) 0)\n" +
" eq. (mod. y 400) 0\n" +
" stdout > @\n" +
" sprintf\n" +
" \"%d is %sa leap year!\"\n" +
" (args.get 0).as-int > year!\n" +
" if. (leap year:y) \"\" \"not \"\n";
}
@NotNull
@Override
public String getDemoText() {
return "+alias org.eolang.io.stdout\n" +
"+alias org.eolang.txt.sprintf\n\n" +
"# is year leap?\n\n" +
"[args...] > main\n" +
" [y] > leap\n" +
" or. > @\n" +
" and.\n" +
" eq. (mod. y 4) 0\n" +
" not. (eq. (mod. y 100) 0)\n" +
" eq. (mod. y 400) 0\n" +
" stdout > @\n" +
" sprintf\n" +
" \"%d is %sa leap year!\"\n" +
" (args.get 0).as-int > year!\n" +
" if. (leap year:y) \"\" \"not \"\n";
}

@NotNull
@Override
public AttributesDescriptor[] getAttributeDescriptors() {
return DESCRIPTORS;
}
@NotNull
@Override
public AttributesDescriptor[] getAttributeDescriptors() {
return EOColorSettingsPage.DESCRIPTORS;
}

@NotNull
@Override
public ColorDescriptor[] getColorDescriptors() {
return ColorDescriptor.EMPTY_ARRAY;
}
@NotNull
@Override
public ColorDescriptor[] getColorDescriptors() {
return ColorDescriptor.EMPTY_ARRAY;
}

@NotNull
@Override
public String getDisplayName() {
return "EO";
}
@NotNull
@Override
public String getDisplayName() {
return "EO";
}
}
54 changes: 37 additions & 17 deletions src/main/java/org/eolang/jetbrains/EOCompletionContributor.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,46 @@
// Copyright 2000-2022 JetBrains s.r.o. and other contributors. Use of this source code is governed
// by the Apache 2.0 license that can be found in the LICENSE file.
/*
* The MIT License (MIT)
*
* Copyright (c) 2021-2022 Stepan Strunkov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package org.eolang.jetbrains;
/*package org.eolang.jetbrains;
import com.intellij.codeInsight.completion.*;
import com.intellij.patterns.PlatformPatterns;
import com.intellij.util.ProcessingContext;
import org.jetbrains.annotations.NotNull;
public class EOCompletionContributor extends CompletionContributor {
public EOCompletionContributor() {
extend(
CompletionType.BASIC,
PlatformPatterns.psiElement(),
new CompletionProvider<CompletionParameters>() {
@Override
public void addCompletions(
@NotNull CompletionParameters parameters,
@NotNull ProcessingContext context,
@NotNull CompletionResultSet resultSet) {
System.out.println(context.getSharedContext());
}
public EOCompletionContributor() {
extend(
CompletionType.BASIC,
PlatformPatterns.psiElement(),
new CompletionProvider<CompletionParameters>() {
@Override
public void addCompletions(
@NotNull final CompletionParameters parameters,
@NotNull final ProcessingContext context,
@NotNull final CompletionResultSet resultSet) {
}
});
}
}
}
}*/
Loading

1 comment on commit 23bd13a

@0pdd
Copy link

@0pdd 0pdd commented on 23bd13a Jul 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:

set -x && set -e && set -o pipefail && cd /tmp/0pdd20220612-12-q4n2xj/objectionary/eo-intellij-plugin && master=master && git config --local core.autocrlf false && git fetch --force --all --quiet && git reset --hard --quiet origin/${master} && git clean --force -d && git checkout origin/${master}...

Please, copy and paste this stack trace to GitHub:

Exec::Error
set -x && set -e && set -o pipefail && cd /tmp/0pdd20220612-12-q4n2xj/objectionary/eo-intellij-plugin && master=master && git config --local core.autocrlf false && git fetch --force --all --quiet && git reset --hard --quiet origin/${master} && git clean --force -d && git checkout origin/${master} && git rebase --abort || true && git rebase --autostash --strategy-option=theirs origin/${master} [1]:
+ set -e
+ set -o pipefail
+ cd /tmp/0pdd20220612-12-q4n2xj/objectionary/eo-intellij-plugin
+ master=master
+ git config --local core.autocrlf false
+ git fetch --force --all --quiet
fatal: Couldn't find remote ref refs/heads/main
error: Could not fetch origin
+ true
+ git rebase --autostash --strategy-option=theirs origin/master
fatal: Needed a single revision
invalid upstream 'origin/master'


/app/objects/exec.rb:60:in `block (2 levels) in run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/open3.rb:219:in `popen_run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/open3.rb:101:in `popen3'
/app/objects/exec.rb:54:in `block in run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/timeout.rb:33:in `catch'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
/app/objects/exec.rb:53:in `run'
/app/objects/git_repo.rb:110:in `pull'
/app/objects/git_repo.rb:75:in `push'
/app/objects/job.rb:36:in `proceed'
/app/objects/job_starred.rb:33:in `proceed'
/app/objects/job_recorded.rb:32:in `proceed'
/app/objects/job_emailed.rb:35:in `proceed'
/app/objects/job_commiterrors.rb:36:in `proceed'
/app/objects/job_detached.rb:48:in `exclusive'
/app/objects/job_detached.rb:36:in `block in proceed'
/app/objects/job_detached.rb:36:in `fork'
/app/objects/job_detached.rb:36:in `proceed'
/app/0pdd.rb:366:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `block in compile!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (3 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1032:in `route_eval'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (2 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1061:in `block in process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1011:in `block in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1129:in `block in dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1124:in `dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `block in call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:929:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/xss_header.rb:18:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/path_traversal.rb:16:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/json_csrf.rb:26:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/frame_options.rb:31:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/logger.rb:17:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/common_logger.rb:38:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:253:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:246:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:216:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1991:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `block in call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1769:in `synchronize'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'

Please sign in to comment.