-
Notifications
You must be signed in to change notification settings - Fork 58
Feature/issue 1508 semicolon extra and missing #1509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alonthedark
wants to merge
24
commits into
1C-Company:master
Choose a base branch
from
alonthedark:feature/issue-1508-semicolon-extra-and-mising
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
4180068
Add checks missing and extra semicolon, qfix.
18040f7
Add checks missing and extra semicolon, qfix.
alonthedark c8d888d
Add checks missing and extra semicolon, qfix.
alonthedark 1538aa2
Add checks missing and extra semicolon, qfix.
alonthedark 604dd88
Add checks missing and extra semicolon, qfix.
alonthedark 719d92a
Add checks missing and extra semicolon, qfix.
alonthedark 4b1ee9d
Add checks missing and extra semicolon, qfix.
alonthedark a951483
Add checks missing and extra semicolon, qfix.
alonthedark 71378da
Add checks missing and extra semicolon, qfix.
alonthedark 7712e6c
Add checks missing and extra semicolon, qfix.
alonthedark 1494474
Update MethodSemicolonExtraCheck.java
alonthedark eeaf544
Update MethodSemicolonExtraFix.java
alonthedark c0f14b4
Update messages.properties
alonthedark a0b426d
Update SemicolonMissingFix.java
alonthedark 1d592bd
Update Messages.java
alonthedark 576a4ce
Изменено подчеркивание лишней точки с запятой подчеркивается только она
93ae72b
Update SemicolonMissingFix.java
alonthedark f09963a
Update MethodSemicolonExtraFix.java
alonthedark 1fc52f5
Update SemicolonMissingCheck.java
alonthedark 22487cb
Update SemicolonMissingCheck.java
alonthedark 2be3c82
Update SemicolonMissingCheck.java
alonthedark 3b42a9a
Изменение проверки и добавление новых тестов
023b240
Добавлено описание
cd7d723
Merge branch 'master' into feature/issue-1508-semicolon-extra-and-mising
alonthedark File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
...m.e1c.v8codestyle.bsl.ui/src/com/e1c/v8codestyle/bsl/ui/qfix/MethodSemicolonExtraFix.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2025, 1C-Soft LLC and others. | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * 1C-Soft LLC - initial API and implementation | ||
| *******************************************************************************/ | ||
| package com.e1c.v8codestyle.bsl.ui.qfix; | ||
|
|
||
| import org.eclipse.emf.ecore.EObject; | ||
| import org.eclipse.jface.text.BadLocationException; | ||
| import org.eclipse.text.edits.DeleteEdit; | ||
| import org.eclipse.text.edits.TextEdit; | ||
| import org.eclipse.xtext.nodemodel.INode; | ||
| import org.eclipse.xtext.nodemodel.util.NodeModelUtils; | ||
| import org.eclipse.xtext.resource.XtextResource; | ||
|
|
||
| import com._1c.g5.v8.dt.bsl.model.EmptyStatement; | ||
| import com.e1c.g5.v8.dt.bsl.check.qfix.IXtextBslModuleFixModel; | ||
| import com.e1c.g5.v8.dt.bsl.check.qfix.SingleVariantXtextBslModuleFix; | ||
| import com.e1c.g5.v8.dt.check.qfix.components.QuickFix; | ||
|
|
||
| /** | ||
| * Removes extra semicolon | ||
| * | ||
| * @author Ivan Sergeev | ||
| */ | ||
| @QuickFix(checkId = "method-semicolon-extra", supplierId = "com.e1c.v8codestyle.bsl") | ||
| public class MethodSemicolonExtraFix | ||
| extends SingleVariantXtextBslModuleFix | ||
| { | ||
|
|
||
| @Override | ||
| protected void configureFix(FixConfigurer configurer) | ||
| { | ||
| configurer.interactive(true) | ||
| .description(Messages.MethodSemicolonExtraFix_Description) | ||
| .details(Messages.MethodSemicolonExtraFix_Description); | ||
| } | ||
|
|
||
| @Override | ||
| protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException | ||
| { | ||
| EObject eobject = model.getElement(); | ||
|
|
||
| if (!(eobject instanceof EmptyStatement)) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| INode node = NodeModelUtils.findActualNodeFor(eobject); | ||
|
|
||
| if (node == null) | ||
| { | ||
| return null; | ||
| } | ||
| INode checkNode = node.getNextSibling(); | ||
| if (checkNode == null) | ||
| { | ||
| return null; | ||
| } | ||
| String checkText = checkNode.getText(); | ||
| INode checkNextNode = checkNode.getNextSibling(); | ||
| if (checkText.contains(";")) //$NON-NLS-1$ | ||
| { | ||
| return new DeleteEdit(checkNode.getTotalOffset(), checkNode.getTotalLength()); | ||
| } | ||
| else if (checkNextNode.getText().contains(";") && !(checkNextNode == null)) //$NON-NLS-1$ | ||
| { | ||
| return new DeleteEdit(checkNextNode.getTotalOffset(), checkNextNode.getTotalLength()); | ||
| } | ||
| return null; | ||
| } | ||
| } |
63 changes: 63 additions & 0 deletions
63
...s/com.e1c.v8codestyle.bsl.ui/src/com/e1c/v8codestyle/bsl/ui/qfix/SemicolonMissingFix.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| /******************************************************************************* | ||
| * Copyright (C) 2025, 1C-Soft LLC and others. | ||
| * | ||
| * This program and the accompanying materials are made | ||
| * available under the terms of the Eclipse Public License 2.0 | ||
| * which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| * Contributors: | ||
| * 1C-Soft LLC - initial API and implementation | ||
| *******************************************************************************/ | ||
| package com.e1c.v8codestyle.bsl.ui.qfix; | ||
|
|
||
| import org.eclipse.emf.ecore.EObject; | ||
| import org.eclipse.jface.text.BadLocationException; | ||
| import org.eclipse.text.edits.InsertEdit; | ||
| import org.eclipse.text.edits.TextEdit; | ||
| import org.eclipse.xtext.nodemodel.INode; | ||
| import org.eclipse.xtext.nodemodel.util.NodeModelUtils; | ||
| import org.eclipse.xtext.resource.XtextResource; | ||
|
|
||
| import com._1c.g5.v8.dt.bsl.model.Conditional; | ||
| import com._1c.g5.v8.dt.bsl.model.Statement; | ||
| import com.e1c.g5.v8.dt.bsl.check.qfix.IXtextBslModuleFixModel; | ||
| import com.e1c.g5.v8.dt.bsl.check.qfix.SingleVariantXtextBslModuleFix; | ||
| import com.e1c.g5.v8.dt.check.qfix.components.QuickFix; | ||
|
|
||
| /** | ||
| * Add missing semicolon | ||
| * | ||
| * @author Ivan Sergeev | ||
| */ | ||
| @QuickFix(checkId = "semicolon-missing", supplierId = "com.e1c.v8codestyle.bsl") | ||
| public class SemicolonMissingFix | ||
| extends SingleVariantXtextBslModuleFix | ||
| { | ||
|
|
||
| @Override | ||
| protected void configureFix(FixConfigurer configurer) | ||
| { | ||
| configurer.interactive(true) | ||
| .description(Messages.SemicolonMissingFix_Description) | ||
| .details(Messages.SemicolonMissngFix_Details); | ||
| } | ||
|
|
||
| @Override | ||
| protected TextEdit fixIssue(XtextResource state, IXtextBslModuleFixModel model) throws BadLocationException | ||
| { | ||
| EObject eobject = model.getElement(); | ||
| if (!(eobject instanceof Statement) & !(eobject instanceof Conditional)) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| INode node = NodeModelUtils.findActualNodeFor(eobject); | ||
| if (node == null) | ||
| { | ||
| return null; | ||
| } | ||
| return new InsertEdit(node.getEndOffset(), ";"); //$NON-NLS-1$ | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
bundles/com.e1c.v8codestyle.bsl/markdown/method-semicolon-extra.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Exta semicolon at the end of method declaration | ||
|
|
||
| A semicolon at the end of a method declaration is not an error, but its absence is preferable. | ||
|
|
||
| ## Noncompliant Code Example | ||
|
|
||
| Procedure procedureName(Parameters); | ||
|
|
||
| A = 1; | ||
|
|
||
| EndProcedure | ||
|
|
||
| ## Compliant Solution | ||
|
|
||
| Procedure procedureName(Parameters) | ||
|
|
||
| A = 1; | ||
|
|
||
| EndProcedure |
23 changes: 23 additions & 0 deletions
23
bundles/com.e1c.v8codestyle.bsl/markdown/ru/method-semicolon-extra.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Лишняя точка с запятой в конце объявления метода | ||
|
|
||
| Точка с запятой в конце объявления метода не является ошибкой но предпочтительно отсутствие. | ||
|
|
||
| ## Неправильно | ||
|
|
||
| Например, неправильно: | ||
|
|
||
| Процедура Ааааa(); | ||
|
|
||
| А = 1; | ||
|
|
||
| КонецПроцедуры | ||
|
|
||
| ## Правильно | ||
|
|
||
| Например, правельно: | ||
|
|
||
| Процедура Ааааa() | ||
|
|
||
| А = 1; | ||
|
|
||
| КонецПроцедуры |
23 changes: 23 additions & 0 deletions
23
bundles/com.e1c.v8codestyle.bsl/markdown/ru/semicolon-missing.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # Отсутствие точки с запятой в конце оператора | ||
|
|
||
| Точка с запятой в конце последнего оператора блока не являеться обязательной, предпочтительно наличие. | ||
|
|
||
| ## Неправильно | ||
|
|
||
| Например, неправильно: | ||
|
|
||
| Процедура Ааааa() | ||
|
|
||
| А = 1 | ||
|
|
||
| КонецПроцедуры | ||
|
|
||
| ## Правильно | ||
|
|
||
| Например, правельно: | ||
|
|
||
| Процедура Ааааa() | ||
|
|
||
| А = 1; | ||
|
|
||
| КонецПроцедуры |
19 changes: 19 additions & 0 deletions
19
bundles/com.e1c.v8codestyle.bsl/markdown/semicolon-missing.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Missing semicolon at the end of statement | ||
|
|
||
| The semicolon at the end of the last statement is not required, but is preferred. | ||
|
|
||
| ## Noncompliant Code Example | ||
|
|
||
| Procedure procedureName(Parameters) | ||
|
|
||
| A = 1 | ||
|
|
||
| EndProcedure | ||
|
|
||
| ## Compliant Solution | ||
|
|
||
| Procedure procedureName(Parameters) | ||
|
|
||
| A = 1; | ||
|
|
||
| EndProcedure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.