GithubHelp home page GithubHelp logo

anima's People

Contributors

acook avatar adz avatar dkubb avatar mbj avatar postmodern avatar snusnu avatar solnic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anima's Issues

Anima breaks on `#with` and `#to_h` if an attribute is private or protected

require 'anima'

Anima::VERSION # => "0.4.2"

class Dog
  include Anima.new(:name, :age, :breed)

  private :breed
end

spot = Dog.new(name: 'Spot', age: 5, breed: 'Dalmatian')
spot                # => #<Dog name="Spot" age=5 breed="Dalmatian">
spot.with(age: 6)   # => private method `breed' called for #<Dog name="Spot" age=5 breed="Dalmatian"> (NoMethodError)
spot.to_h           # => private method `breed' called for #<Dog name="Spot" age=5 breed="Dalmatian"> (NoMethodError)

Full key status report on initialization errors

Currently anima's initialization error reports are weak.

  • For the first missing key an exception is raised, resulting in more debugging cycles for more missing keys.
  • If an extra key is present an exception is raised for all extra keys.
  • If a key is missing no extra keys are reported.

IMHO anima should report a "full" key-state report if ANY error condition is found. Generating the full report will result in more computation but efficiency on the error code path is not a primary objective.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Default values in initializer

I think it would be a good practice to allow default values to attributes. Something like:

require 'anima'

# Definition
class Person
  include Anima.new(name: '', age: 0)
end

a = Person.new(age: 30)
# => #<Person name="" age=30>

Release v1.0

I do not think this library is missing anything. I'm at all for releasing an 1.0 version. Feel free to add your comment here to discuss.

EDIT: I think #3 should be solved before releasing v1.0.

Add Anima.attribute_names

Recently, I've found myself doing private(*anima.attributes.map(&:name)) quite often. Usually from within anima infected builder objects.

Include `Anima::Update` per default.

A recent analysis shows my personal usage of Anima is paired in 95% of the cases with an inclusion of Anima::Update into the same host.

I do not think the optional Anima::Update has any justification than.

Interested in other peoples experience. //cc @snusnu, @plexus, @solnic, @dkubb.

bug in README

hi there,
We are working on ataru, a documentation testing tool and have tested the anima documentation with it. Ataru found mistake in line 76:

1) Failure:
#<Class:0x00000002c64998>#test_README_0 [README.md:76]:
--- expected
+++ actual
@@ -1 +1 @@
-{:salutation=>"Mrs", :firstname=>"Sue"}
+{:salutation=>"Mrs", :firstname=>"Sue", :lastname=>"Doe"}

hope that's helpfull.

Use of mutation testing in anima - Help needed

Hello there!

My name is Ana. I noted that you use the mutation testing tool mutant in the project.
I am a postdoctoral researcher at the University of Seville (Spain), and my colleagues and I are studying how mutation testing tools are used in practice. With this aim in mind, we have analysed over 3,500 public GitHub repositories using mutation testing tools, including yours! This work has recently been published in a journal paper available at https://link.springer.com/content/pdf/10.1007/s10664-022-10177-8.pdf.

To complete this study, we are asking for your help to understand better how mutation testing is used in practice, please! We would be extremely grateful if you could contribute to this study by answering a brief survey of 21 simple questions (no more than 6 minutes). This is the link to the questionnaire https://forms.gle/FvXNrimWAsJYC1zB9.

Drop me an e-mail if you have any questions or comments ([email protected]). Thank you very much in advance!!

Optional attributes

What do you think about support for optional (with defaults) attributes?

Something like:

class Person
  include Anima.new(:salutation, :firstname, :lastname, age: 18)
end

person = Person.new(salutation: 'Mr', firstname: 'James')
person.lastname # nil
person.age      # 18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.