Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Conversation

@AndreyTretyak
Copy link
Contributor

Follow-up after #931

The main idea was to enforce a custom header in the LlvmBindings project.
The downside of it would be that other settings in both stylecop.json would need to be in sync with each other.
I think it worth it since different headers hard to keep in sync manually.

If any other project would need to add custom stylecop.json it would be enough to just add it into the project folder.

After removing warning suppression and fixing trivial warnings the only file with a problematic header was DelaySign.cs since it had a standard header and included in multiple projects.
To solve that I've moved sing properties into AssemblyCommon.props, this has an additional benefit that now there is no need to include file DelaySign.cs in every project, but the downside is that all project including AssemblyCommon.props would use it by default. When we don't need signing in the project it could be removed by defining <SignAssembly>false</SignAssembly>.

As additional changes, I've defined some convenience flags in MSBuild to simplify some conditions. Also some small fixes of headers in LlvmBinding.

In the future main improvement would be to replace the direct import of AssemblyCommon.props with Directry.Build.props and I would like to do it as a follow-up, to keep this PR smaller.

@AndreyTretyak AndreyTretyak marked this pull request as draft April 1, 2021 19:41
@AndreyTretyak AndreyTretyak marked this pull request as ready for review April 1, 2021 20:47
@AndreyTretyak AndreyTretyak marked this pull request as draft April 1, 2021 22:36
@AndreyTretyak AndreyTretyak marked this pull request as ready for review April 1, 2021 22:36
…ylecop-config-for-llvm

# Conflicts:
#	src/QsCompiler/LlvmBindings/LlvmBindings.csproj
#	src/QsCompiler/QirGeneration/QirGeneration.csproj
@AndreyTretyak
Copy link
Contributor Author

@SamarSha @swernli could you please review whenever you'll have time?

@bettinaheim bettinaheim requested a review from anpaz April 8, 2021 03:30
@anpaz
Copy link
Member

anpaz commented Apr 8, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@swernli swernli self-requested a review April 8, 2021 05:18
@anpaz
Copy link
Member

anpaz commented Apr 8, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Member

@anpaz anpaz left a comment

Choose a reason for hiding this comment

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

Looks great. I have confirmed that signing still works correctly. I think we're good to go.

@AndreyTretyak
Copy link
Contributor Author

AndreyTretyak commented Apr 9, 2021

@anpaz thank you for the review and validating signing. Is there anything else needed from me to merge this PR?

Copy link
Contributor

@bettinaheim bettinaheim left a comment

Choose a reason for hiding this comment

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

@anpaz thank you for the review and validating signing. Is there anything else needed from me to merge this PR?

Looks good. I'll go ahead and make sure it gets merged.

@@ -1,5 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// <copyright file="LLVMMemoryBufferRefExtensions.cs" company="Ubiquity.NET Contributors">
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe all files in the LLVMSharpExtensions folder were indeed fully authored by us as part of porting. However, I don't see issues with having a partial copyright for all files in the LLVMBindings folder, so if this works better with the stylecop, I believe that should be fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, sorry I thought that default header was used in those files by mistake.
It really simplifies things a lot to use the Ubiquty.NET header for all files in the project (so it's great that you fine with it, thanks) because StyleCop does not support different headers in the same project and it looks like, currently, there is no way to suppress it in a single file DotNetAnalyzers/StyleCopAnalyzers#1701. The only alternative I see is disabling the check for the project (then custom stylecop.json for the project also could be removed).

@bettinaheim
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@bettinaheim bettinaheim merged commit 7f85168 into microsoft:main Apr 16, 2021
@AndreyTretyak AndreyTretyak deleted the andreyt/custom-stylecop-config-for-llvm branch April 16, 2021 21:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants