Skip to content
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

Fix final and abstract access modifiers #34

Merged
merged 5 commits into from
Jul 7, 2020

Conversation

kdorsel
Copy link
Contributor

@kdorsel kdorsel commented Jun 29, 2020

Fix for abstract and final access modifiers for FB and methods
Fixes #32 #36

@Roald87
Copy link
Owner

Roald87 commented Jun 29, 2020

Hey kdorsel,

Thanks you very much for the PR. I'll have look at it tomorrow.

Roald

Copy link
Owner

@Roald87 Roald87 left a comment

Choose a reason for hiding this comment

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

Can you also add some tests to the TcBlackTests project in ObjectDefinitionTests.cs? Perhaps best to collect the tests in a new method, something like AbstractAndFinalModifiersForMethodsAndFunctionBlocks

@@ -138,7 +153,7 @@ private TcObject TokenizeFunctionBlock()
private TcObject TokenizeMethodOrProperty()
{
string entityType = @"\s*(FUNCTION|METHOD|PROPERTY)\s*";
string accessModifier = @"(PRIVATE|PUBLIC|PROTECTED|INTERNAL)?\s*";
string accessModifier = @"(PRIVATE|PUBLIC|PROTECTED|INTERNAL|FINAL|ABSTRACT)?\s*";
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
string accessModifier = @"(PRIVATE|PUBLIC|PROTECTED|INTERNAL|FINAL|ABSTRACT)?\s*";
string accessModifier =
@"(PRIVATE|PUBLIC|PROTECTED|INTERNAL|FINAL|ABSTRACT)?\s*";

I'm trying to also maintain the 88 line length limit in the code itself. See for more info https://github.com/Roald87/TcBlack/blob/master/CONTRIBUTING.md#use-a-consistent-coding-style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, is there a C# Black that can be added to the project?

Copy link
Owner

Choose a reason for hiding this comment

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

I haven't found a free one unfortunately. There is https://www.jetbrains.com/resharper/, but you have to pay for that one.

@kdorsel
Copy link
Contributor Author

kdorsel commented Jun 30, 2020

Can you also add some tests to the TcBlackTests project in ObjectDefinitionTests.cs? Perhaps best to collect the tests in a new method, something like AbstractAndFinalModifiersForMethodsAndFunctionBlocks

I'll create a test suite for these.

@kdorsel
Copy link
Contributor Author

kdorsel commented Jun 30, 2020

I'm having troubles with loading the test project with this error:

C:\Users\kdorsel\Documents\github\TcBlack\src\TcBlackTests\TcBlackTests.csproj : error : The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format. C:\Users\kdorsel\Documents\github\TcBlack\src\TcBlackTests\TcBlackTests.csproj

Comparing the TcBlack and TcBlackTests csproj they are completely different. I'm using VS2015.

@Roald87
Copy link
Owner

Roald87 commented Jun 30, 2020

I haven't tried to run the project with VS2015. In the contributing https://github.com/Roald87/TcBlack/blob/master/CONTRIBUTING.md#use-a-consistent-coding-style document I recommend to use VS2017. Is that an issue for you?

The fact that they are so different is an artifact from the past. I initially stared the project using .NET Core. Later I converted to the .NET Framework. Apparently I didn't convert the unit test project.

I'll have a look if I can convert the unit test project as well.

@kdorsel
Copy link
Contributor Author

kdorsel commented Jun 30, 2020

I need VS2015 since TC3 Database Server doesn't work on VS2017 yet. I can get VS2017 also, but beside that file I haven't had any issues.

@Roald87
Copy link
Owner

Roald87 commented Jun 30, 2020

Ok let me try to change it. As long as you don't upload the .csproj file maybe it'll be fine.

@Roald87
Copy link
Owner

Roald87 commented Jun 30, 2020

Does the test in this branch run?

https://github.com/Roald87/TcBlack/tree/xunit-in-net-framework

@kdorsel
Copy link
Contributor Author

kdorsel commented Jun 30, 2020

The UnitTestDotNetFramework project loads and I can access it. But when I Run All Tests I get no results and it looks like no tests are run.

I'll look more into it. I'll also get VS2017 and try and report back.

https://xunit.net/docs/getting-started/netfx/visual-studio
https://stackoverflow.com/questions/44573009/does-xunit-runner-visualstudio-not-work-for-visual-studio

@Roald87
Copy link
Owner

Roald87 commented Jun 30, 2020

Is was some option under Tests > General I believe which you have to disable. It was something with optimization blabla. You should turn that off, then it worked for me.

@kdorsel
Copy link
Contributor Author

kdorsel commented Jul 1, 2020

In VS2017, everything works fine from the main branch (TcBlackTests). I'll work on adding the tests now for this.

Sorry for adding the extra work! The xunit-in-net-framework branch is no longer needed.

@Roald87
Copy link
Owner

Roald87 commented Jul 1, 2020

No problem. I didn't want to scare away the first contributor 😛 .

@Roald87 Roald87 added this to the Version 0.2 milestone Jul 1, 2020
@Roald87 Roald87 added the enhancement New feature or request label Jul 1, 2020
@kdorsel
Copy link
Contributor Author

kdorsel commented Jul 1, 2020

Updated with tests and also closes #36 now.

Copy link
Owner

@Roald87 Roald87 left a comment

Choose a reason for hiding this comment

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

It looks very good!

It only fails when I add more than one space between PUBLIC/PRIVATE... and ABSTRACT or FINAL. So for example the following test fails

[InlineData(
    "METHOD  PROTECTED   FINAL Sum : BOOL",
    "METHOD PROTECTED FINAL Sum : BOOL"
)]

Can you try to also catch this case?

src/TcBlack/ObjectDefinition.cs Show resolved Hide resolved
src/TcBlack/ObjectDefinition.cs Outdated Show resolved Hide resolved
@Roald87 Roald87 merged commit 9e67d4e into Roald87:master Jul 7, 2020
@Roald87
Copy link
Owner

Roald87 commented Jul 7, 2020

Thank you very much for your contribution!

@kdorsel kdorsel deleted the access-modifiers branch July 8, 2020 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Removes FB name from declaration when using FINAL
2 participants