how to modify rules in perlcritic [closed] - perl

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Hie ,
Perl critic (Source Code Analyser).
I am new to this . Although I have studied the documentation and know how to run it (That's not enough!).
I want to modify the rules (i.e include,exclude or add my own rules to it).
I know .perlcriticrc file can do that.
But I don't know how to do it.
Thank you

According to the doco for Perl::Critic, you can add a "policy" with the add_policy( -policy => $policy_name, -params => \%param_hash ) method:
-policy is the name of a Perl::Critic::Policy subclass module. The 'Perl::Critic::Policy' portion of the name can be omitted for brevity. This argument is required.
Then, when you look at the linked documentation for the subclass module (emphasis mine);
To work with the Perl::Critic engine, your implementation must behave as described below. For a detailed explanation on how to make new Policy modules, please see the Perl::Critic::DEVELOPER document included in this distribution.
... we see there's a whole document covering exactly what you want to do.
What part of that document are you having trouble with?

Related

Are there copy constructors in Swift structures? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
It's known, that when assigning an instance of structure to another instance, or passing it to a function, Swift essentially copies the instances by value. However I could not find anywhere if we actually have control over this process, like in C++ copy constructors. My question is whether Swift has analogue to C++ copy constructors and if not, are there anything in the language what helps to take control over passing-by-value process in Swift?
Copy constructors are implicit in Swift, and can't be user-customized.
They always copy all fields of a struct. For fields that are references to object, copying is defined as the increment of reference count (a retain).

When creating a REST API are there any naming conventions for designating a read only property? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I was thinking it would be useful if the property name clearly signaled it was readonly.
Take this object as an example:
{
"id":"12154",
"name":"some name",
"email":"email#something.com",
"joinDate":"05/04/2012"
}
id and joinDate are of course properties that are readonly and will not allow a change through a PUT/POST request. Is there some type of convention for marking these as such? I was thinking of doing this with underscores:
{
"_id":"12154",
"name":"some name",
"email":"email#something.com",
"_joinDate":"05/04/2012"
}
There is no naming convention for read-only properties in REST. You should, of course, feel free to establish whatever conventions you like for your own API. As Fiver said in his comment, you should make sure they are clearly documented, or your conventions will be some combination of (a) confusing, and (b) noise.

Is there a Coffeescript equivalent for Dart [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
The main aspect of CoffeeScript I'd like to see available also for Dart in form of a different, Dart-based language would be less verbosity, less brackets, less Java-style.
Does such solution exist ?
No.
If you don't want to have your field static you can omit the static keyword.
If you don't want to have your field final you can write var or a concrete type instead of the final keyword.
And if you don't want a loop you can omit for, while, forEach, ...

How is SUPER pseudo class is resolved in perl? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am new to perl and I was reading up different concepts and came across SUPER.I have few doubts .
How is the SUPER pseudo class is resolved in perl? Its not clear in perlobj.
Can anyone help me understand it
Check out the section title "How SUPER is Resolved" on perldoc.
SUPER isn't really even a pseudo-class. Calling it such may lead to thinking you can do things you can't with it.
->SUPER::methodname simply calls the method that would have been called by __PACKAGE__->methodname() if there were no sub method in __PACKAGE__ (N.B. the class or object on the left of -> is irrelevant). (quoting myself in Why doesn't Perl's SUPER call use the arrow method?)
Do you mean MRO (method resolution order)? The "Method Resolution Order" section in perldoc perlobj describes the specification.

How to list all called methods? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Is there any way that I can list all called methods like there are called one after the other? For example now I am doing same thing in way that I'm putting NSLog(#"MethodName"); i every that method.
I want to do that by automatic way in NSLog. Is it possible?
If you don't have too much methods you can use
NSLog(#"%#" , NSStringFromSelector(_cmd));
to log their names. This way you don't have to copy the signatures manually each time.
Create a property 'NSMutableArray *calledMethods;`
And in each of your method use
[self.calledMethods addObject:NSStringFromSelector(_cmd)];
And whenever you want to print it NSLog it.
I think you want:
printf("%s\n", __PRETTY_FUNCTION__ ) ;
Which produces (for example)
-[AppDelegate application:didFinishLaunchingWithOptions:]
Or, you can use dtrace. This answer should help: https://stackoverflow.com/a/3874726/210171.
Also check https://stackoverflow.com/a/4604249/210171 (same linked question). Seems there's an environment variable NSObjCMessageLoggingEnabled you can set...