This is ethical formalism. This set of ethics holds that judgments are to be made on the laws, rather than on how the judgment will affect other people. In these ethics, any action that is wrong would be considered wrong in all cases, as would the opposite for any action considered right.