asizikov / asyncsuffix Goto Github PK
View Code? Open in Web Editor NEWAsynchronous methods naming checker for ReSharper
Home Page: http://asizikov.github.io/2015/08/02/async-suffix-resharper-plugin/
License: MIT License
Asynchronous methods naming checker for ReSharper
Home Page: http://asizikov.github.io/2015/08/02/async-suffix-resharper-plugin/
License: MIT License
Use this snippet instead:
private static bool IsTestMethod(IDeclaredElement declaredElement)
{
var utm = declaredElement.GetSolution().GetComponent();
return (declaredElement is IMethod || declaredElement is IProperty) && utm.IsElementOfKind(declaredElement, UnitTestElementKind.Test);
}
//[Solution...]
var valueProperty = storage.BindToContextLive(lifetime, ContextRange.ApplicationWide).GetValueProperty();
public interface IMyInterface
{
Task Foo(); //should not show warning here
}
public class Class : IMyInterface
{
public Task Foo()
{
return null;
}
}
Plugin suggests to rename WebAPI actions which is not completely correct. WebAPI action name should not reflect the way how it is executed.
Example: I get a suggestion to rename CityController.Get(...) action to "GetAsync"
ReSharper has been updated recently and now ignores AsyncSuffix (no suggestions at all :( )
If method name is something like Foo_Bar_Baz()
ignore it.
Please add support for Resharper 2017.2 (wave >=9).
Thanks :)
As an option make this feature configurable
[Test]
public async Task FooWhenBoo()
{
///
}
AsyncSuffix plugin for ReSharper doesn't work with ReSharper's InspectCode command line tool. Maybe the "R# platform zone markers" must be fixed (see https://youtrack.jetbrains.com/issue/RSRP-436208).
The plugin is not available for R# 2017.1. Please add support for the new version.
Tag builds should be published
Allow marking of custom types with an attribute to consider them "Task types".
From what I observed it should be enough to add an || type.HasAnAttributeThatSaysSo()
to https://github.com/asizikov/AsyncSuffix/blob/master/AsyncSuffix/Analyzer/TaskExtensions.cs#L9. Admittedly, I would not know how to implement that method.
returnType.GetTypeElement().IsDescendantOf()
var valueProperty = storage.BindToContextLive(lifetime, ContextRange.ApplicationWide)
.GetValueProperty();
private static bool IsTestType(IDeclaredElement declaredElement)
{
var utm = declaredElement.GetSolution().GetComponent<IUnitTestElementStuff>();
return declaredElement is ITypeElement && utm.IsElementOfKind(declaredElement, UnitTestElementKind.TestContainer);
}
private static bool IsTestMethod(IDeclaredElement declaredElement)
{
var utm = declaredElement.GetSolution().GetComponent<IUnitTestElementStuff>();
return (declaredElement is IMethod || declaredElement is IProperty) && utm.IsElementOfKind(declaredElement, UnitTestElementKind.Test);
}
For clients of particular type only public method names matters. There is no need to suggest Async suffix for private methods. For example I have public methods which checks for arguments or states and throws exceptions immediately (these methods don't have 'async' keyword for 'fail-fast' reasons). And these methods delegate actual work to some private methods like "DoSomeActionInternal" or something like that. These method are hidden from outer client so it's pretty annoying to have suffix suggestions.
It would be nice to have some settings to turn off these suggestions for private methods.
Update AsyncMethodNameUtil
returnType.GetTypeElement().IsDescendantOf(customType);
Please add support for ReSharper 2018.2.
Thanks
For now I just compare the end of the method name with 'Async' string. That method works ok when the suffix is just missing. However in case of typo it will produce ugly method name:
MethodAsyn()
-> MethodAsynAsync()
.
public Task Method |
Suggest MethodAsync name here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.